HTML Entities Encode and Decode

Escape text so it shows up as text inside HTML, or turn entity-filled text back into something readable. Works as you type, on this page.

How it works

HTML reads five characters as markup: < and > open and close tags, & starts an entity, and the two quote marks end attribute values. To show them as text, they are written as entities: &lt; &gt; &amp; &quot; and &#39;.

Encoding escapes those five, which is all valid HTML needs. Turn on Escape non-ASCII too and every accented letter, symbol and emoji is written as an entity as well, by name where one exists (&eacute;) and by number otherwise (&#128512;).

Decoding understands named entities such as &copy; and &nbsp;, decimal ones such as &#233; and hex ones such as &#xE9;. It all runs on this page; nothing is sent anywhere.

How to use it

  1. 1 Pick Encode or Decode.
  2. 2 Paste your text or HTML into the first box. The result updates as you type.
  3. 3 When encoding, turn on Escape non-ASCII too if the page or email it is going into might not be read as UTF-8.
  4. 4 Copy the result or download it as a .txt file. Swap sends it back to the first box and flips the direction.

Good to know

  • Escaping is what stops text from being read as HTML. If you show user input on a page, it must be escaped, or a comment containing <script> becomes code.
  • An entity name this tool does not know, or a lone &, is left exactly as written, which is also what browsers do.
  • The decoder knows the 253 named entities of HTML 4, which cover the ones found in real text. HTML5 adds about two thousand rarely used names.
  • &nbsp; decodes to a non-breaking space, which looks like a space but is a different character. Search and replace may treat it differently.

Browser support

  • Chrome 94 and later
  • Firefox 93 and later
  • Safari 16.4 and later
  • Edge 94 and later

These are the oldest versions with everything the tool uses. They are worked out from the tool itself, so they change when it does.

Version numbers checked on 2026-09-04.

Why "Tom & Jerry" has to become Tom &amp; Jerry

An HTML file is text in which some characters are instructions. When a browser reads <b>, it does not show the three characters; it starts bold text. When it reads &, it expects the name of a character to follow. That is fine until the text you want to show contains those characters itself. Write "Use <b> for bold" into a page as it is, and the browser makes the rest of the sentence bold instead of showing the tag. Write "Tom & Jerry" and it usually works, but only because browsers forgive a lone ampersand. Write "R&D;" and some browsers will try to read &D; as an entity.

Entities are the escape hatch. Each one starts with & and ends with ;, and between them is either a name or a number. &lt; is <, &gt; is >, &amp; is & itself, &quot; is a double quote and &#39; is an apostrophe. So the snippet <b>Tom & Jerry</b>, escaped to be shown as text, becomes &lt;b&gt;Tom &amp; Jerry&lt;/b&gt;. The browser turns each entity back into its character and draws it, and nothing is read as markup. That is all encoding does in its default setting, and those five characters are all that valid HTML requires.

Numbers work for any character at all. &#233; is é because é is Unicode code point 233, and &#xE9; is the same number written in hex. That is how a page could show accents and symbols back when files were saved in encodings that had no room for them, and it still helps when text has to pass through a system you do not trust to keep UTF-8 intact, such as an old mail server. With Escape non-ASCII too turned on, the tool writes every character beyond plain ASCII this way, using a name where HTML 4 defines one, &eacute; or &copy;, and a decimal number otherwise, such as &#128512; for 😀.

This is also a security matter, and the most common one on the web. If a site takes a comment, a name or a search term and puts it into a page without escaping it, then a visitor who types <script> has added a script to the page that runs for everyone who views it. That attack is called cross-site scripting, and escaping the five markup characters is the basic defence. Template systems such as React, Vue and Django escape by default for this reason. This tool is for the times you are handling the text yourself: writing an example into a blog post, filling an attribute by hand, or reading what a system has escaped.

The decoder has two honest limits. It knows the 253 named entities defined in HTML 4, which include every accented Latin letter, Greek, arrows, maths symbols, typographic quotes and dashes. HTML5 added about two thousand more, such as &NotNestedLessLess;, which almost nobody uses; an unknown name is left as written, exactly as a browser would leave it. And a numeric reference that does not stand for a character, such as &#x110000; past the end of Unicode, is reported as an error rather than silently replaced, so you know the input itself is broken.

Frequently asked questions

Which characters have to be escaped in HTML?

Inside text, only < and &, because they start a tag and an entity. Inside an attribute value, the quote mark that surrounds it too. Escaping all five of < > & " and ' everywhere is the simple rule that is always safe, and it is what this tool does.

What is the difference between &eacute;, &#233; and &#xE9;?

Nothing, to a browser: all three are é. The first is a named entity, the second gives the character’s Unicode number in decimal, the third the same number in hex. Names are easier to read; numbers work for every character, including emoji, which have no names.

Do I need to escape accents and emoji?

Not on a page saved and served as UTF-8, which is nearly every page today. Escaping them helps when the text passes through something that might mangle non-ASCII characters, such as an old email system or a template with the wrong encoding.

Why does the decoder report an error on &#x110000;?

Because that number is past U+10FFFF, the last code point Unicode has, so it does not stand for any character. The same goes for &#0; and for numbers in the surrogate range D800 to DFFF. The message points at the reference so you can find it.

Related tools

Your files are processed on your device and are not uploaded. You can verify this in your browser’s developer tools under the Network tab.