Developer Tools

Free HTML Entity Encoder & Decoder

Escape &, <, > and quotes as named, decimal or hex entities โ€” or decode any HTML entity back to readable text. Fully offline in your browser.

100% Private Named ยท Dec ยท Hex Full Unicode Instant

Your Input

Text or HTML to encode
0 characters Live conversion as you type
Tip: Use Minimal mode to escape only the five HTML-unsafe characters โ€” perfect for embedding user text safely. Use Encode all to also convert accented letters and symbols to entities.

Encoded Output

No output yet

Start typing in the left panel to see the result

What Are HTML Entities?

HTML entities are codes that represent characters which would otherwise be interpreted as markup, or that cannot be typed directly. They start with an ampersand and end with a semicolon. When a browser renders your HTML, every entity is replaced with the character it represents before the page is displayed.

There are three ways to write the same entity, and this tool can produce any of them:

FormExampleRenders as
Named&lt;<
Decimal&#60;<
Hex&#x3C;<

All three are equivalent โ€” the browser renders them identically. Named entities are the most readable and are what most source code uses. Decimal and hex forms are more verbose but work for every Unicode code point, including characters that have no named entity.

The five characters you must escape

Every HTML document should escape at least these five characters, because each one has special meaning in HTML markup:

CharacterEntityWhy it matters
&&amp;Starts every entity โ€” a bare ampersand can be misread
<&lt;Opens a tag
>&gt;Closes a tag
"&quot;Terminates a double-quoted attribute
'&#39; or &apos;Terminates a single-quoted attribute

Everything else โ€” letters, digits, most punctuation โ€” can be left as literal characters in a UTF-8 document. That's what the tool's Minimal mode does.

When to use named vs numeric entities

FormBest forDownside
NamedHand-written HTML, documentation, editable sourceOnly ~2,000 named entities exist โ€” not every character has one
DecimalAutomated output, wide character coverageLonger, harder to read
HexWhen you already know the code point (e.g. U+2764 โ†’ &#x2764;)Requires hex fluency

Common HTML entities cheat sheet

CharacterNamedDecimalHex
&&amp;&#38;&#x26;
<&lt;&#60;&#x3C;
>&gt;&#62;&#x3E;
"&quot;&#34;&#x22;
'&apos;&#39;&#x27;
(space)&nbsp; (non-breaking)&#160;&#xA0;
ยฉ&copy;&#169;&#xA9;
ยฎ&reg;&#174;&#xAE;
โ„ข&trade;&#8482;&#x2122;
โ‚ฌ&euro;&#8364;&#x20AC;
โ†’&rarr;&#8594;&#x2192;
โค&hearts;&#9829;&#x2665;

Why escape HTML at all?

Common use cases

Escape User Input

Sanitize text before inserting it into HTML to prevent XSS.

Show Code Samples

Display HTML markup on a page without the browser rendering it.

Read Source Code

Decode entities in third-party HTML you're trying to read.

Email & RSS

Email clients and RSS feeds often prefer entities over UTF-8.

XML Compatibility

XML only defines five named entities โ€” numeric ones fill the gap.

Database Cleanup

Decode entities that were stored literally by an importer.

Query String Safety

Escape & and = inside query parameter values.

CMS Content

Bypass rich-text editors that strip literal special characters.

Privacy and security

This HTML entity converter runs entirely in your browser. Encoding and decoding use JavaScript string operations and a built-in entity lookup table โ€” no network requests, no server, no analytics on your input. Safe for API keys, customer data, internal HTML and anything else you would rather not paste into a stranger's server.

Frequently Asked Questions

What are HTML entities?
HTML entities are codes that represent characters which would otherwise be interpreted as markup, or which cannot be typed directly. They start with an ampersand and end with a semicolon. For example, &lt; represents a less-than sign, &amp; represents an ampersand, and &copy; represents the copyright symbol.
Is this HTML entity converter free?
Yes. It is 100% free, requires no sign-up, and runs entirely in your browser. No input-size limits, no watermarks, no premium tier.
Is my data sent to a server?
No. All encoding and decoding happens locally in your browser. Nothing is uploaded, stored or transmitted. Your text never leaves your device.
What is the difference between named, decimal and hex entities?
Named entities use a short mnemonic like &lt; or &nbsp; and are the most readable form. Decimal entities use the Unicode code point in base 10, written as &#60; for a less-than sign. Hex entities use base 16 with an x prefix, written as &#x3C;. All three forms are equivalent and every modern browser renders them identically.
Which characters must be escaped in HTML?
The five characters that must always be escaped are: the ampersand (&amp;), the less-than sign (&lt;), the greater-than sign (&gt;), the double quote (&quot;) and the single quote or apostrophe (&#39; or &apos;). The first two are essential because they begin markup; the quotes matter when their content appears inside an attribute value.
Do I need to escape every special character?
No. Only the characters that would be misread as HTML markup need escaping. Symbols like &copy;, &reg; and &trade; work fine as literal characters in UTF-8 documents, and the tool's Minimal mode escapes only the five unsafe characters to keep the output clean and readable.
What is &nbsp; and should I use it?
&nbsp; is a non-breaking space (U+00A0). It looks like a regular space but prevents the browser from wrapping between the two words it separates. It is useful for keeping units together like 10&nbsp;kg, but overusing it breaks text reflow on mobile and harms accessibility, so use it sparingly.
Why does my decoded text still contain &?
If your output still shows an ampersand, it is likely that the input was double-encoded. A string like &amp;lt; decodes once to &lt; and needs a second pass to become a literal < character. Paste the result back into the decoder and run it again, or enable the tool's strict decode toggle for an automatic second pass.
Should I escape quotes in HTML?
You must escape a quote only when it matches the quote character that delimits the attribute you are inside. In double-quoted attributes escape &quot;, and in single-quoted attributes escape &#39;. This tool escapes both by default so the output is safe in either context.
Will escaped HTML still render correctly in a browser?
Yes. HTML entities are rendered by the browser as their underlying characters. &lt;strong&gt;Hello&lt;/strong&gt; displays as the literal text <strong>Hello</strong> rather than rendering bold text. This is exactly what you want when displaying code samples, user-generated content or documentation.

Related Developer Tools

Done!