HTML Entity Encoder/Decoder

Encode special characters as HTML entities, or decode entities back to text.

Direction
0 words · 0 charactersNot uploaded

Encode and decode HTML entities

HTML reserves a few characters: < and > start and end tags, & starts an entity, and quotes delimit attributes. To show them as text, they must be written as entities.

Encoding modes

Mode “Café & ” becomes
Only < > & " ' Café &amp; &lt;b&gt;, the safe minimum for UTF-8 pages
Non-ASCII (named) Caf&eacute; &amp; &lt;b&gt;, for systems that only accept ASCII
Everything named named entities wherever HTML5 defines one
Numeric references Caf&#xE9; &#x26; &#x3C;b&#x3E;, works everywhere, including XML

Decoding understands all 2,231 named entities in the HTML5 specification (&nbsp;, &mdash;, &hearts;…), decimal (&#233;) and hexadecimal (&#xE9;) references, including emoji like &#x1F600;.

Modern pages served as UTF-8 only need the minimal mode; the others exist for legacy systems, email templates and XML.

Worked example

Here is what the HTML Entity Encoder/Decoder returns for its built-in example. Settings used: Direction: Encode; Encode: Only < > & " '. Click Try an example in the tool above to load it, then change it as you like.

Input
Café & “quotes” <b>bold</b> — 5 > 3 😀
Output
Café &amp; “quotes” &lt;b&gt;bold&lt;/b&gt; — 5 &gt; 3 😀

Related tools: Text to HTML Converter, URL Encoder / Decoder.

Questions

How do I escape HTML characters?

Choose Encode with the first option. The five reserved characters (less-than, greater-than, ampersand and both quote marks) are replaced with entities.

What does &nbsp; mean?

A non-breaking space: a space that prevents a line break between two words.

Last reviewed · How Textkiln tools work