HTML Encoder / Decoder
Convert special characters to HTML entities for safe display in web pages — or decode entities back to readable text. Both directions update live as you type.
How it works
HTML reserves a handful of characters for its own markup: <, >, &, and quotes. To display these characters as text on a web page instead of having the browser interpret them as code, they are replaced with entities — for example, < becomes < and & becomes &. Encoding your input this way is also the standard defense against cross-site scripting, since injected markup can no longer execute. Characters outside basic ASCII, like “—” or “€”, are converted to numeric entities such as — so they survive any character encoding. Decoding reverses the process, turning named entities (©), decimal references (©), and hexadecimal references (©) back into their characters.
How to use
- Paste or type your text into the “Your text” box — sample markup is pre-filled so you can see the encoding immediately.
- The encoded version (HTML entities) and the decoded version update live as you type, in both directions.
- Click “Copy encoded” to grab the entity version for pasting into a web page where the characters must display as text.
- To go the other way, read the decoded box: it turns named entities (
©), decimal references (©), and hexadecimal references (©) back into readable characters.
Frequently asked questions
Why encode < as <?
HTML reserves <, >, &, and quotes for its own markup. Replacing them with entities makes the browser display them as text instead of interpreting them as code — which is exactly what you want when showing a code sample on a page.
Does encoding prevent cross-site scripting (XSS)?
It is the standard first line of defense: injected markup can no longer execute once its angle brackets are entities. It is necessary but not sufficient on its own — always validate and sanitize untrusted input on the server too.
What happens to characters like — or €?
Characters outside basic ASCII are converted to numeric entities such as —, so they survive any character encoding and display correctly everywhere.
What entity formats can it decode?
All three common forms: named entities (© → ©), decimal numeric references (© → ©), and hexadecimal references (© → ©).