Use this free HTML entity encoder and decoder to escape special characters so they display as text on a web page, or to turn entities such as & and © back into readable characters. Paste your text, choose Encode or Decode, and the result appears instantly. You can write entities as names, decimal numbers, or hexadecimal numbers, encode accented letters and symbols, and leave existing entities untouched. You can copy the result, download it as a text file, or send it back to the input to convert it again. Everything runs in your browser and the result updates as you type.

Decoded text is shown as plain text and is never rendered as HTML. Before you place decoded text on a web page, escape it again for the place where it will go.

How to use the HTML entity encoder and decoder

Paste your text and the converted version appears instantly.

  • Paste your text: add plain text or HTML to encode, or text that contains entities to decode.
  • Choose a mode: pick Encode to entities or Decode entities.
  • Adjust the options (optional): encode only the special characters or all non-ASCII characters too, choose named, decimal, or hexadecimal entities, and decide whether existing entities are left alone.
  • Copy or download: copy the result, download it as a .txt file, or use Use as input to convert the result again.

What each mode does

ModeExampleWhat it does
Encode to entities<b> → &lt;b&gt;Replaces special characters with entities so a browser shows them as text instead of reading them as markup.
Decode entities&lt;b&gt; → <b>Converts named, decimal, and hexadecimal entities back to the characters they stand for.

Common HTML entities

CharacterEntityWhy it matters
&&amp;Starts every entity, so a literal ampersand should be escaped.
<&lt;Starts a tag, so it must be escaped to show as text.
>&gt;Ends a tag, so it is escaped along with the less-than sign.
"&quot;Closes a double-quoted attribute, so escape it inside attribute values.
'&#39;Closes a single-quoted attribute. The numeric form works in every HTML version.
Non-breaking space&nbsp;A space that does not wrap and is not collapsed by the browser.
©&copy;Copyright sign, common in page footers.
€&euro;Euro sign, which some older systems cannot display directly.
—&mdash;Em dash, often typed as a double hyphen by mistake.

What this tool does and does not do

This tool converts characters to and from HTML entities. It does not clean up, validate, or sanitize HTML, and it does not remove scripts or tags. Escaping characters is one part of keeping a page safe, but the right escaping depends on where the text goes, such as page text, an attribute, a script, or a URL, so use your framework's built-in escaping for real pages. When decoding, only complete entities that end with a semicolon are converted, and an unknown name such as &madeup; is left as written. Pages saved as UTF-8 do not need accented letters or symbols encoded, so leave that option off unless a system requires it.

Encode once, at the point where text is placed into HTML. Encoding the same text twice turns &amp; into &amp;amp;.

Worked examples

Showing code on a web page

Paste <p class="note">Hello</p> and choose Encode to entities. The tags become &lt;p class=&quot;note&quot;&gt;Hello&lt;/p&gt;, so a browser displays the code instead of running it as markup.

Reading text full of entities

Paste Caf&eacute; &amp; Bar &#8211; Open &#x32;4/7 and choose Decode entities. The result is readable text with the accent, ampersand, dash, and number restored. Named, decimal, and hexadecimal entities are all converted.

Preparing text for an older system

Open the options, choose special characters and all non-ASCII characters, and pick named or decimal entities. A line such as "Café €5" becomes entities that survive systems which cannot store UTF-8 characters.

Common HTML entity mistakes

  • Encoding twice. A second pass turns &amp; into &amp;amp;, which then shows as a visible &amp; on the page. Use the option to leave existing entities alone if your text is mixed.
  • Forgetting the semicolon. An entity without its closing semicolon may or may not work, depending on the browser and the name.
  • Encoding for the wrong place. Text inside a script, a style block, or a URL needs different escaping from text in a page body.
  • Encoding everything. Turning every accented letter into an entity makes the source hard to read and is not needed on a UTF-8 page.

Frequently asked questions

What are HTML entities?

HTML entities are codes that stand for characters in an HTML document. They start with an ampersand and end with a semicolon, such as &lt; for the less-than sign, &amp; for the ampersand, and &eacute; for the letter é.

Why do I need to encode HTML characters?

Characters such as <, >, and & have special meaning in HTML. Encoding them lets you show them as visible text instead of having the browser read them as markup.

What is the difference between named, decimal, and hex entities?

They are three ways to write the same character. A named entity uses a short name such as &copy;, a decimal entity uses the character's number such as &#169;, and a hexadecimal entity uses the number in base 16 such as &#xA9;. Not every character has a name, but every character has a number.

Why does my text show &amp;amp; after encoding twice?

Encoding text that already contains entities converts its ampersands again, so &amp; becomes &amp;amp;. Decode once to undo it, or choose to leave existing entities untouched when encoding.

Do I need to encode accented letters and symbols?

Not on a page saved as UTF-8, which is the standard today. Accented letters and symbols display correctly as they are. Encoding them is only needed for systems that cannot handle UTF-8.

Is the decoded text safe to paste into my page?

The tool shows decoded text as plain text and never runs it. Decoded text can contain real tags, though, so escape it again before you place it into a page.

Where does my text go?

The conversion runs in your browser. This page does not send or save the text you paste, and clearing the form removes it from the screen.

Is there a limit on text length?

The tool accepts up to 100,000 characters of text. For longer content, convert it one section at a time.

Share this article