HTML Encoder / Decoder
Encodes and decodes HTML entities, escaping and unescaping special characters.
Input
0 characters · 0 bytes (UTF-8)
Shortcut: Alt+Shift+S switches direction.
Output
Enter text to see the result.
Runs entirely in your browser. Your input is not uploaded or stored.
How the method works
Encoding escapes text for one HTML context; it is not a sanitiser, and decoding runs exactly once per action. Fixed example values for illustration — not your result.
How to use this calculator
- Choose Encode or Decode. For encoding, pick the context: element text, or a quoted attribute value.
- Paste your text. The output updates as you type, with character and byte counts.
- Copy or download the result; every escaped or decoded part is highlighted. To decode a second layer, switch direction deliberately — the button or Alt+Shift+S makes the output the new input.
How it works
Text mode escapes &, < and >; attribute mode also escapes " and '. Named (&) or numeric (&) references are your choice, and existing entities can be kept rather than double-encoded.
Decoding runs once, through the browser's own HTML parser in an inert document, so every named and numeric reference follows the HTML standard — and the result is only ever shown as text.
Escaping protects one context; it is not sanitising a whole HTML document, and event attributes, JavaScript, CSS and URLs each need their own handling.
Worked example
A&B< and &lt;. Encoding A&B< gives A&B<. Decoding &lt; once gives < — not <, because it was encoded twice.
Common mistakes
- Using text-mode escaping inside an attribute (quotes must be escaped there).
- Decoding repeatedly until nothing changes, which can turn data back into markup.
- Treating escaped text as a sanitised HTML document.
Tips
- Runs entirely in your browser. Your input is not uploaded or stored.
Frequently asked questions
When do I need this?
To show literal HTML or code on a page, or to read entity-encoded text.
Privacy?
Runs entirely in your browser. Your input is not uploaded or stored.
Related tools
- URL Encoder / Decoder
- Base64 Encoder / Decoder
- Markdown to HTML Converter
- HTML to Markdown Converter
- JWT Decoder
- Cron Expression Parser
Explore more in PDF, Image, File, Data & Developer Tools.
Cite this tool
Zerdly. (2026). HTML Encoder / Decoder. Retrieved from https://www.zerdly.com/tools/html-encoder-decoder/
Tip: Enter any known values to calculate the remaining results.
Designed to run locally in your browser. Tool inputs are not intentionally stored by Zerdly unless stated otherwise.



