HTML Entity Encoder & Decoder – Escape & Unescape Special Characters

Convert plain text to safe HTML entities, or decode named, decimal, and hex entities back to readable characters. Choose from three encoding scopes, named or numeric output, and inspect a character-by-character analysis. Free, private, and runs entirely in your browser.

Input & Settings

Encode mode · Safe minimum
Encode mode: Converts plain text to HTML entities. Switch to Decode to turn entities back into readable characters.
Scope
Entity format

Output

Encoded HTML entities
Input chars
0
Output chars
0
Entities
0
Encoded HTML entities
Character analysis 0 converted
CharCode pointEntityCount

Common HTML entities reference

Click any row to load that character into the input. Use the search box to filter by character, name, or description.

CharNamedDecimalHexDescription

What is HTML entity encoding?

HTML uses certain characters as syntax: < opens a tag, > closes it, & starts an entity, and quotes delimit attribute values. If you want to display the literal text <div> on a web page without the browser parsing it as a tag, you must encode it as &lt;div&gt;. That's what HTML entity encoding does.

Entity encoding matters for two reasons. First, it makes special characters display correctly. Second, and more importantly, it prevents cross-site scripting (XSS) vulnerabilities when you insert user-generated or third-party content into an HTML template. If you skip encoding, a malicious string like <script>alert(1)</script> would execute as code instead of appearing as text.

This tool gives you three encoding scopes so you can match the output to your exact use case, plus a decoder that handles named, decimal, and hexadecimal entities in one pass.

Encoding scopes explained

ScopeWhat it encodesBest for
Safe minimumOnly &, <, >, ", and 'Escaping user input before inserting it into an HTML template. Produces the most readable output.
Full non-ASCIIThe five safe-minimum characters plus every non-ASCII character (accented letters, symbols, emoji)When your output must be strict ASCII for maximum compatibility across legacy systems and email clients.
Numeric allEvery single character, including plain letters and digitsObfuscation, parser testing, and certain email compatibility requirements.

The entity format option controls how each encoded character is represented. Named entities like &copy; are human-readable. Decimal entities like &#169; work for any character. Hex entities like &#xA9; are compact and commonly used in CSS and JavaScript contexts.

Named vs numeric entities

Named entities are shorthands defined by the HTML standard. There are roughly 2,000 of them, covering everything from &amp; to &Afr;. They're easier to read and remember, which makes them a good choice for hand-written HTML.

Numeric entities reference the character's Unicode code point directly. Decimal uses base 10 (&#169;), hex uses base 16 (&#xA9;). Numeric entities work for any Unicode character, including those without a named entity — CJK characters, rare symbols, and emoji. If you're encoding content that might contain arbitrary Unicode, numeric entities are the safer choice.

This tool prefers named entities when a character has one, and falls back to decimal or hex when it doesn't. That gives you readable output for common characters and universal coverage for everything else.

Why decode HTML entities?

Decoding is the reverse operation: it turns entity references back into the characters they represent. You'll need it when you're debugging encoded output, cleaning up data that's been double-encoded, or extracting readable text from HTML source.

The decoder in this tool handles all three entity formats — named, decimal, and hex — in a single pass. It also tolerates missing semicolons for common cases, which is useful when you're dealing with hand-written or legacy HTML that doesn't always follow the spec strictly.

Frequently asked questions

HTML entity encoding replaces characters that have special meaning in HTML — like <, >, &, and quotes — with safe entity references such as &lt;, &gt;, and &amp;. This prevents the browser from interpreting your text as markup, which is essential for displaying code, user input, and special characters safely.
Named entities use human-readable names like &copy; or &nbsp;, while numeric entities reference the character's Unicode code point directly, either in decimal (&#169;) or hexadecimal (&#xA9;). Named entities are more readable; numeric entities work for any character, including those without a named entity.
Safe minimum encodes only the five characters that must always be escaped in HTML content and attributes: &, <, >, double quote, and single quote. This is the correct mode for escaping user input before inserting it into an HTML template.
Full non-ASCII encodes the five safe-minimum characters plus every non-ASCII character — accented letters, currency signs, symbols, and emoji. Use this when your output must be strict ASCII for maximum compatibility.
Numeric all encodes every single character as a numeric entity, including plain letters and digits. This is useful for obfuscation, testing how a parser handles numeric references, or certain email compatibility requirements.
Yes. The decoder handles named entities like &amp;, decimal entities like &#38;, and hexadecimal entities like &#x26;, with or without a trailing semicolon for common cases.
After encoding, the character analysis panel lists every character that was converted, along with its Unicode code point and the entity it was replaced with. This helps you verify exactly what changed.
Absolutely. Everything runs in your browser. The text you paste never leaves your device — there is no server processing, no logging, and no data storage.
Yes. The tool is fully responsive and works on phones, tablets, and desktops.
Yes. Once the page loads, the encoder and decoder work without an internet connection. All processing happens locally in your browser using JavaScript.