HTML Entity Encoder / Decoder
Convert characters to HTML entities and back. Supports named, decimal, and hex encoding.
Encoding Mode
Free online HTML entity encoder and decoder
HTML entity encoding is a fundamental part of web security and content rendering. Characters like <, >, and & must be escaped before being rendered inside HTML to prevent them from being interpreted as markup. This tool provides four encoding modes: essential, all-named, decimal, and hex: covering every use case from basic XSS prevention to full Unicode escaping.
The built-in Reference tab gives you a searchable table of named HTML entities, useful when you need to look up the correct code for a symbol like ©, ®, or an arrow. Whether you're sanitising user input, writing email templates, or debugging entity-encoded content, all processing happens instantly in your browser without sending data anywhere.
Step-by-step guide
- 1Choose Encode, Decode, or Reference
Use the tabs to select whether you want to encode text to HTML entities, decode entities back to plain text, or browse the reference table. - 2Select an encoding mode
On the Encode tab, choose Essential (< > & " '), All named entities, Decimal ({), or Hex ({) depending on your use case. - 3Paste your input text
Type or paste the text you want to encode or the entity-encoded string you want to decode into the input area. - 4Review the output
The encoded or decoded result appears instantly on the right, with a character count delta shown below. - 5Copy the result
Click the Copy button next to either panel to grab the result and paste it into your HTML, template, or code editor.
Related Tools
JSON Formatter
Validate, format, minify, and explore JSON. Syntax highlighting, error detection, and tree view.
HTML Beautifier
Format messy HTML with proper indentation. Also minifies HTML for production.
SQL Formatter
Format SQL queries with keyword casing, indentation, and clause alignment.
Regex Tester
Test regular expressions with live matching, group capture, flags, and match highlighting.
Frequently Asked Questions
- What are HTML entities?
- HTML entities are special sequences used to represent characters that have a meaning in HTML markup (<, >, &) or characters outside the ASCII range. They take the form &name; (named), &#123; (decimal), or &#x7B; (hexadecimal).
- When should I encode HTML entities?
- Encode entities whenever you display user-generated text in an HTML context to prevent XSS (cross-site scripting) attacks. You should also encode them when embedding special characters like copyright symbols, arrows, or accented letters in HTML.
- What is the difference between Essential and All Named modes?
- Essential mode encodes only the five characters that have special meaning in HTML: < > & " and '. All Named mode additionally converts common symbols like © ® € and arrows to their named entity equivalents.
- Does this tool send my text to a server?
- No. All encoding and decoding runs entirely inside your browser. No data is transmitted anywhere.
- Can this tool decode numeric entities like € or €?
- Yes. The Decode tab handles named entities (&amp;), decimal numeric entities (&#123;), and hex numeric entities (&#x7B;) all at once.
- What is the Reference tab for?
- The Reference tab shows a searchable table of all supported named entities with their character, entity name, decimal code, and hex code. Use it to look up the correct entity for any symbol.
- Is &apos; a valid HTML entity?
- &apos; is defined in XML and XHTML but was not part of the original HTML4 spec. In HTML5 it is fully valid. For maximum compatibility with older HTML parsers, use &#39; or &#x27; instead.
- Why does encoding increase character count?
- Each encoded entity takes more characters than the original symbol. For example & becomes &amp; (5 chars). The character delta shown below the panels lets you track this expansion.
AlteredIdea vs alternatives
vs server-side tools: Everything runs in your browser: your data never leaves your device.
vs VS Code extensions: No install needed. Works instantly in any browser.
vs paid tools: Completely free, no account required.