HTML Entity Encoder / Decoder

Convert special characters to HTML entities so code shows as text, or decode entities back to plain characters. Everything runs in your browser — your text never leaves your device.

Mode:

How to encode or decode HTML entities

  1. Choose Encode to turn special characters into entities, or Decode to turn entities back into plain text.
  2. Paste your text or HTML into the top box. In Encode mode you can also tick Encode all non-ASCII to convert accented and symbol characters to numeric entities.
  3. The result updates as you type. Click Copy to grab it.

Why encode angle brackets and ampersands?

When you want to show code on a web page, the characters that make up the markup have to be escaped, or the browser will try to run them. For example the tag <div> becomes &lt;div&gt;, which the browser prints as the literal text <div> instead of building a real element. The five characters that must be escaped are the ampersand &, the angle brackets < and >, the double quote and the apostrophe — they become &amp;, &lt;, &gt;, &quot; and &#39;. Encoding also helps when preparing text for an HTML email or a template, where a stray & or bracket could break the layout.

Encode vs decode — which do I need?

Use Encode when you have raw text or a code snippet and need a version that is safe to paste into an HTML page. Use Decode when you have already-escaped content — copied from a page source, an export or an API response — and want the original readable characters back. Decoding is also a quick way to fix mojibake, where entities such as &amp; or numeric codes were left in the text by mistake, turning them back into the symbols they represent.

Is it safe? Does it run the HTML?

No — decoding never renders your input. Instead of dropping the text into a live element, this tool decodes named entities through a small built-in lookup map and resolves numeric entities like &#39; and &#x27; with a regular expression. Because the HTML is never parsed or executed, pasting a snippet is completely safe. And like every Toolyard tool, it all happens in your browser — your text is never uploaded.

Frequently asked questions

What is the difference between encode and decode?

Encode turns special characters into HTML entities so they display as text; decode turns entities like &lt; back into the original characters.

Why encode angle brackets?

Encoding the less-than and greater-than signs stops a browser from reading them as HTML tags, so a snippet such as a div is shown as text instead of being rendered.

Does this tool run or execute the HTML?

No. Decoding is done with a safe entity map and a numeric regex, not by rendering the input, so nothing in your text is ever executed as HTML.

Which characters are encoded?

The five special characters: ampersand, less-than, greater-than, double quote and apostrophe. You can also optionally encode every non-ASCII character as a numeric entity.

Is my text private?

Yes. Encoding and decoding run entirely in your browser. Your text is never uploaded and stays private on your device.