HTML Entities

Encode or decode HTML entities online: escape <, &, quotes and symbols to named or numeric codes, or unescape &amp; and &#169; with a live preview.

Runs in your browser. Files never leave your device.
Common Entities Cheat Sheet:
&lt; : <&gt; : >&amp; : &&quot; : "&#39; : '&copy; : ©&reg; : ®&trade; : ™&euro; : €&nbsp; : space

About the HTML Entities

Encode HTML entities so code shows as text on a web page, or decode them to turn &lt;, &amp; and &#169; back into the characters they stand for. You need the first when a code sample pasted into a CMS or a documentation page keeps turning into real tags, and the second when text from a feed or export arrives full of escaped characters.

There are two encoding styles. Named Entities escapes the five characters that matter in markup and writes other special characters as numeric codes; Numeric Entities converts every character, letters included. Decoding understands every named entity browsers know, plus decimal and hex codes, and shows a rendered preview. Nothing is uploaded. The page does the work locally and refreshes the output with each keystroke.

How HTML escaping and unescaping work

In HTML, < starts a tag, & starts an entity and quotes end an attribute value, so those characters have to be escaped to appear literally. In Named Entities mode the tool replaces < > & " and ' with &lt; &gt; &amp; &quot; and &#39;. Everything from U+00A0 up to U+9999, which includes accented letters, symbols such as © and €, typographic quotes and dashes, Greek, Cyrillic, Arabic and most Chinese characters, becomes a decimal code such as &#233;. Plain ASCII letters, digits and spaces stay as they are.

Numeric Entities mode writes every character, letters and spaces included, as &#code; using its Unicode code point, so 😀 becomes &#128512;. The result is long and hard to read, but it contains nothing except &, #, digits and semicolons, which suits systems that mangle anything else.

Decoding hands the text to the browser's own HTML parser inside a text field, so all of the more than 2,000 named references defined by HTML are resolved, along with &#233; and &#xE9; forms, while tags stay as plain text. The preview underneath then renders the decoded result as HTML after cleaning it with DOMPurify, which removes scripts, event attributes such as onerror, javascript: links and styles.

Assumptions and limits

  • Named mode uses names only for the five markup characters: © becomes &#169; rather than &copy;. Both display identically in every browser.
  • Characters above U+9999, such as Korean Hangul and emoji, are left unchanged in Named mode. On a page saved as UTF-8, which almost every page is, that's fine.
  • Numeric mode writes one code per Unicode character, so an emoji becomes a single code such as &#128512; for 😀. Some emoji are built from several characters, such as a skin tone or a flag, and give one code for each part.
  • Encoding doesn't recognise existing entities: an &amp; already in the input is escaped again to &amp;amp;. Decode partly escaped text first, then encode it once.
  • The preview is cleaned before it renders: scripts, event attributes, javascript: links, form fields and all styling are removed, so it shows structure and text rather than an exact copy of the page. The two text boxes always show plain text.

Worked examples

Escape HTML to show a code snippet in a blog post

Pasting markup straight into a post makes the browser treat it as real tags. Encode the sample <div class="example">Hello & Welcome! 'Quote'</div> with Named Entities and paste the output inside a <pre> or <code> block; readers then see the code instead of an empty box.

&lt;div class=&quot;example&quot;&gt;Hello &amp; Welcome! &#39;Quote&#39;&lt;/div&gt;

Decode HTML entities from a feed or database export

Text from RSS feeds, CMS exports and scraped pages often looks like Tom &amp; Jerry &#8211; &quot;Classic&quot;. Switch to Decode and it reads Tom & Jerry – "Classic", ready for a spreadsheet or a plain-text email.

Prices and symbols in Named mode

Price: €20 © 2026 – “quoted” encodes to Price: &#8364;20 &#169; 2026 &#8211; &#8220;quoted&#8221;. The letters and digits stay readable, and the result displays correctly even on a page with the wrong character set declared.

Common HTML entities

The last column shows what this tool's Named Entities mode writes for each character.

CharacterNamed entityNumeric entityNamed mode output
<&lt;&#60;&lt;
>&gt;&#62;&gt;
&&amp;&#38;&amp;
" (double quote)&quot;&#34;&quot;
' (apostrophe)&apos;&#39;&#39;
Non-breaking space&nbsp;&#160;&#160;
©&copy;&#169;&#169;
®&reg;&#174;&#174;
™&trade;&#8482;&#8482;
€&euro;&#8364;&#8364;
– (en dash)&ndash;&#8211;&#8211;
é&eacute;&#233;&#233;

How to use the HTML Entities

  1. Pick Encode or Decode. Encode HTML Entities escapes text for a page; Decode HTML Entities turns entities back into characters.
  2. Choose the entity style when encoding. Named Entities keeps the output readable; Numeric Entities converts every character to a &#code;.
  3. Paste your text and copy the output. The result updates as you type. Press Copy, and when decoding check the rendered preview below the boxes.

Frequently asked questions

How do I escape HTML so the code shows on the page?

Paste the code in Encode mode with Named Entities selected, then copy the result into your page, preferably inside <pre><code>. Every < becomes &lt; and every & becomes &amp;, so the browser displays the characters instead of building tags from them.

What is the difference between named and numeric HTML entities?

Only the spelling. A named entity uses a word, such as &copy;, and a numeric one uses the character's Unicode number, &#169; in decimal or &#xA9; in hex. Browsers treat them the same. Names are easier to read but exist only for some characters, whereas a number works for any character.

Which characters must be escaped in HTML?

In ordinary text, & and < must be escaped, and > is escaped too for safety. Inside an attribute value, also escape the quote character that wraps it, " or '. The simple rule that works everywhere is to encode all five, which is what Named mode does.

Why does my page show &amp;amp; instead of &?

The text was escaped twice: once by you or a plugin, and again by the CMS or template. Paste it into Decode, possibly twice, until it reads normally, then let only one layer of your system do the escaping.

Does escaping HTML entities protect against XSS?

Partly. Escaping user input before placing it in HTML text or a quoted attribute is the main defence against cross-site scripting in those two places. It doesn't cover JavaScript, CSS or URL contexts, which need their own encoding, so prefer your framework's templating, which escapes automatically.

What is &nbsp; and when should I use it?

It's a non-breaking space, U+00A0: it looks like a space but stops a line from breaking there, useful between a number and its unit, as in 10&nbsp;kg. Named mode writes it as &#160;, which is the same character.

This tool runs entirely in your browser. What you enter or upload stays on your device and is never sent to our servers.