HTML Encode/Decode
Encode special characters to HTML entities or decode them back.
Built and tested by Muhammad Irfan Liaqat · Updated
HTML Encode/Decode: key facts
- Encodes the five characters that matter in HTML: & < > " and '
- Decodes & < > " ' and numeric entities such as © or ©
- Named entities other than those, such as ©, are left as they are
- Converts as you type; nothing is uploaded
What HTML encoding changes and why
HTML encoding replaces characters that have a special meaning in HTML with entities, so a browser shows them as text instead of reading them as markup. This tool encodes < as <, > as >, & as &, double quotes as " and single quotes as '. Decoding reverses those, plus and numeric entities such as © or ©.
Encode text when you want to show code samples on a web page, put user-supplied text inside HTML, or use quotes inside an attribute value. Decode it when copied text or an API response shows codes like &amp; instead of the characters. Escaping output this way is the core defence against cross-site scripting (XSS), but in a real application let your framework or template engine escape output automatically rather than encoding strings by hand.
How to encode or decode HTML entities
- 1Paste your text into the input box
- 2Click Encode to convert special characters to entities, or Decode to convert them back
- 3Check the result in the output box
- 4Click Copy to copy it