HTML Entity Encoder / Decoder
Encode and decode HTML entities, with optional encoding of all non-ASCII characters.
Privacy: This tool runs entirely in your browser. Your data never leaves your device and is never uploaded to any server.
How to use this HTML entity encoder
- Paste the text or markup you want to encode.
- Choose whether to encode every non-ASCII character or only the special ones.
- Switch to decode to turn entities back into characters.
- Encoding happens locally; nothing is uploaded.
Entities you will actually need
| Character | Named | Numeric | Why it matters |
|---|---|---|---|
| & | & | & | Every ampersand must be escaped, including inside URLs |
| < | < | < | Otherwise the browser starts reading a tag |
| > | > | > | Closes a tag, though it is usually safe in body text |
| " | " | " | Ends a quoted attribute early |
| ' | ' | ' | The same problem inside a single-quoted attribute |
| space | |   | A space that will not wrap or collapse |
What an HTML entity is
An entity is a short code that stands in for a character. & represents an ampersand and < represents a less-than sign.
Because < and > delimit tags, a browser cannot tell literal text from markup without help. Entities remove that ambiguity.
Named and numeric forms
Named entities such as & and © are readable but limited to a defined list.
Numeric entities such as © work for any character at all, which is why they are the safe fallback for symbols without a name.
Encoding is also a security measure
If you display user-supplied text without escaping it, an attacker can close your markup and inject their own — the classic cross-site scripting bug.
Escaping, or letting a framework do it, is what stops a comment containing a script tag from becoming executable. Never treat it as optional.
The entities worth knowing by heart
- & — ampersand, the one people forget.
- < and > — the angle brackets that delimit tags.
- " — a double quote inside an attribute.
- ' or ' — an apostrophe inside an attribute.
- — a non-breaking space that will not wrap.
Frequently asked questions
What are HTML entities?
HTML entities represent reserved characters such as <, > and &, or non-ASCII characters, as named or numeric codes.
Why encode HTML?
Encoding prevents browsers from interpreting text as markup, which is useful for displaying code snippets safely.
Is my text uploaded?
No. Encoding and decoding happen locally in your browser.
Should I use named or numeric entities?
Named entities are readable and fine for the common characters. Numeric ones work for anything at all, including symbols that have no name, so they are the safe fallback.
Does encoding change how the text looks?
No. The browser renders the entity as the character it represents, so an ampersand written as & still displays as an ampersand.
Do I need to encode quote characters?
Only inside an attribute. In body text a quote is harmless, but inside a quoted attribute it would end the attribute early.
More Encoding & Hashing tools
Base64 Encoder / Decoder
Encode or decode text to and from Base64, including URL-safe mode and file-to-Base64 conversion with Unicode support.
URL Encoder / Decoder
Encode and decode URLs or URI components following RFC 3986, perfect for query strings, paths and shareable links.
Hash Generator
Generate MD5, SHA-1, SHA-256 and SHA-512 hashes using the Web Crypto API. Your input never leaves your browser.
JWT Decoder
Decode and inspect the header, payload and signature of a JSON Web Token, entirely in your browser.