Skip to content

HTML Entities

✨ Updates as you type 0 lines · 0 B

Encoded

Paste text on the left

Special characters become < & " and friends
Nothing to encode yet

HTML Entity Encoder & Decoder – Free Online Tool

What are HTML Entities?

Some characters mean something special in HTML. A < starts a tag and an & starts an entity, so if you want to show them as plain text you have to write them differently. HTML entities are those different spellings: &lt; for <, &amp; for &, &copy; for ©. The browser shows the character, but it never mistakes it for code.

Encoding turns characters into entities. You need it when you show code on a web page (like the examples below), put user text into HTML, or write characters that might get mangled in an old email or XML file. Decoding does the opposite: it turns &lt;p&gt; back into <p>, which is handy when you copy escaped text out of a database, an API response or a page source. This tool does both, right in your browser.

How to Use It – Step by Step

Five short steps. Paste the examples into the tool above to try them.

Step 1 Pick Encode or Decode

Use the Encode / Decode switch above the result. Then paste your text on the left, open a file, or click Sample (it loads a sample for whichever direction you picked). The result updates as you type.

  • Encode: you have normal text or HTML and want it safe to show inside a web page.
  • Decode: you have text full of &amp; and &#39; and want it readable again.

Step 2 Encode the Five Special Characters

By default only & < > " and ' are encoded. That’s all HTML ever requires, and it keeps everything else readable. This is what you need to show a piece of HTML as text on a page, for example inside a <pre> block.

Try it: a link shown as code

Text:

<a href="/search?q=tea&cups=2">Tea & "Cake"</a>

Encoded:

&lt;a href=&quot;/search?q=tea&amp;cups=2&quot;&gt;Tea &amp; &quot;Cake&quot;&lt;/a&gt;

💡 See the & in the URL? It becomes &amp; too. Technically that’s the correct way to write it in an href, and the browser turns it back into & when you click.

Step 3 Encode Accents, Symbols and Emoji Too

Tick Non-ASCII too and every character outside plain English ASCII becomes an entity, so the text survives even in places that aren’t UTF-8. Choose the Style: named entities are easier to read, numeric ones work for every character. Named mode uses a number when a character has no name, like emoji.

Try it: Café © 2026 – 5 € 😀

Named:

Caf&eacute; &copy; 2026 &ndash; 5 &euro; &#128512;

Numeric:

Caf&#233; &#169; 2026 &#8211; 5 &#8364; &#128512;

Step 4 Decode Entities Back to Text

Switch to Decode and paste text with entities. Named (&eacute;), decimal (&#169;) and hex (&#x1F600;) entities all work, because the browser’s own HTML parser does the decoding. It knows every one of the 2,000+ names, even the odd ones.

Try it: escaped HTML from a database

Encoded:

&lt;p&gt;Fish &amp; Chips &ndash; only &pound;5!&lt;/p&gt;
Caf&eacute; &#169; 2026 &#x1F600;

Decoded:

<p>Fish & Chips – only £5!</p>
Café © 2026 😀

💡 Seeing &amp;lt;? That text was encoded twice. Decode it, then click Swap to decode the result once more.

Step 5 Swap, Copy or Download

  • Swap: moves the result to the left and flips the direction, so you can check a round trip.
  • Copy: puts the result on your clipboard.
  • Download: saves it as a .txt file.
  • Next step: paste decoded HTML into the HTML Viewer to see how it renders, or into the HTML Formatter to tidy it up.

Common HTML Entities

The ones you’ll use most. Named and numeric versions mean exactly the same thing. Need another one? See the full list of HTML entities (300+ characters, click to copy).

CharacterNamedNumericName
& &amp; &#38; Ampersand
< &lt; &#60; Less than
> &gt; &#62; Greater than
" &quot; &#34; Double quote
' &apos; &#39; Apostrophe
(space) &nbsp; &#160; Non-breaking space
© &copy; &#169; Copyright
® &reg; &#174; Registered
™ &trade; &#8482; Trademark
€ &euro; &#8364; Euro
£ &pound; &#163; Pound
– &ndash; &#8211; En dash
— &mdash; &#8212; Em dash
… &hellip; &#8230; Ellipsis
→ &rarr; &#8594; Right arrow
× &times; &#215; Multiply

Frequently Asked Questions

What is an HTML entity?

A short code that stands for a character, starting with & and ending with ;. For example &lt; is <, &amp; is &, and &copy; is ©. Browsers show the character, but the code itself can’t be mistaken for HTML. You can write the same character by name (&copy;), by decimal number (&#169;) or by hex number (&#xA9;).

Which characters must be encoded in HTML?

In normal text, & and < always, because they start entities and tags. Inside an attribute value, also the quote you wrapped the value in (" or '). Encoding > as well is common and harmless. Those five, & < > " ', are what this tool encodes by default.

Do I need to encode é, ü, € or emoji?

Not if your page is saved as UTF-8 and has <meta charset="utf-8">, which is true for nearly every modern site. Tick “Non-ASCII too” when the text goes somewhere that might not be UTF-8, like an old email template, an XML feed or a system that mangles special characters. Then every non-ASCII character becomes a plain-ASCII entity.

Named or numeric entities, which is better?

Both work in every browser. Named ones like &eacute; and &euro; are easier to read. Numeric ones like &#233; work for every character, including emoji, which have no names. In Named mode this tool uses a name when there is a well-known one and falls back to a number otherwise.

Why is the apostrophe &#39; and not &apos;?

&apos; is valid in HTML5 but wasn’t part of HTML 4, and some older email apps still don’t understand it. &#39; works everywhere, so it’s the safer choice.

How does decoding work? Is it safe?

Decoding uses the browser’s own HTML parser, so it understands all 2,000+ named entities plus decimal and hex ones, exactly like a real page would. It happens in a detached document where text can’t become elements and scripts can’t run, so pasting untrusted text is safe. Nothing is uploaded.

Is encoding enough to stop XSS?

Encoding text before you put it inside HTML is a key step against cross-site scripting, but each place has its own rules: URLs, JavaScript strings and CSS need different escaping. In real apps, let your framework’s templates do the escaping for you and use this tool for content, docs and debugging.