HTML Entity Encoder and Decoder
Paste text and choose to encode its special characters into HTML entities, or decode entities such as & and © back into characters.
Use the tool
Loading the tool…
About HTML Entity Encoder and Decoder
Convert characters into HTML entities, or entities back into characters. Choose what to encode: only the characters with special meaning in HTML (&, <, >, and quotation marks), or those plus accents and symbols as names, decimal numbers or hexadecimal numbers.
Worked example
Encode `cafĂ© <b>` with the reserved characters and accents as names. The output uses é for the accent and < and > for the angle brackets.
Limits
Encoding protects the page from being read as HTML, but it is not a full security measure on its own. Check the output in the place it will be used.
How to use HTML Entity Encoder and Decoder
- Choose to encode or decode.
- For encoding, choose how far to go, from only the reserved characters to every non-ASCII character.
- Paste your text and use Copy the result.
Good to know
- The reserved characters are & < > " and the apostrophe. Encoding them makes text safe to show inside HTML.
- Decoding handles the 252 named entities of HTML 4.01 plus ', and decimal and hexadecimal numeric entities. Only entities that end with a semicolon are decoded.
- Entities are decoded once, so &lt; becomes <.
- This tool does not clean or sanitise HTML for security. Use a proper sanitiser for untrusted content.
Frequently asked questions
Why encode the < and > characters?
Browsers treat them as the start and end of tags. Encoding them lets the characters show up as text.
Is this enough to prevent XSS?
No. Escaping depends on where the text is placed. Use your framework's escaping and a sanitiser for untrusted input.
Is anything I type saved or sent?
No. The work happens in your browser on this page, and nothing is stored or sent to us.