DevTools Hub

HTML Encoder / Decoder

Encode and decode HTML entities.

Runs locally
InputPlain text
42 chars
OutputHTML entities
Ready
The output will appear here.
Status
HTML entities processed locally.

How it works

HTML entities let a document contain characters that would otherwise be parsed as markup. Encoding turns & < > " and ' into &amp; &lt; &gt; &quot; and &#39;, which is what stops user-supplied text from being read as tags.

Decoding handles the named entities amp, lt, gt, quot, apos, and nbsp, plus any numeric reference: decimal such as &#8364; or hexadecimal such as &#x20AC;, both of which produce the euro sign.

A named entity the decoder does not recognise is left exactly as it was rather than dropped, so nothing is silently lost from your input.

Frequently asked questions

Which characters does HTML encoding escape?
The five that matter for markup safety: ampersand, less-than, greater-than, double quote, and apostrophe. Everything else, accented letters and emoji included, is left alone, because modern pages are UTF-8 and do not need those escaped.
What is &nbsp;?
A non-breaking space, U+00A0. It looks like an ordinary space but prevents a line break at that point, which is why it turns up throughout content copied out of word processors and CMS editors.
Does it decode named entities such as &copy; or &mdash;?
Not by name. The decoder recognises amp, lt, gt, quot, apos, and nbsp. Their numeric forms do work: &#169; produces the copyright sign and &#8212; produces an em dash. Any unrecognised named entity is returned unchanged.
Is HTML encoding the same as URL encoding?
No. HTML entities protect characters inside a document's markup, while percent-encoding such as %20 or %3A protects characters inside a URL. Text pulled out of an HTML page can need both, applied in order.