HTML Entity Encoder & Decoder: how to use it
Convert special characters like < > & and quotes to HTML entities and back, and learn why displaying code on a web page needs encoding.
In HTML, characters such as the less-than sign, the greater-than sign and the ampersand have special meaning. If you want to show them as visible text, for example when writing a tutorial that displays code, they must be written as entities such as < and &. This tool converts text to entities and back.
It is also handy for reading text that was copied from page source and is full of codes like " and ©.
How to use the HTML Entity Encoder & Decoder
- Paste your text into Input text.
- Press Encode entities to turn special characters into entities, or Decode entities to turn entities into characters.
- Read the Result and press Copy result.
- Press Clear to reset both boxes.
Tips for better results
- Encode the ampersand first and always. A raw ampersand can start an entity by accident.
- Quotes need encoding when you place text inside an HTML attribute value.
- Decoding handles named entities such as © as well as numeric ones such as ©.
- If you see & in text, it was encoded twice. Decode once for each level.
Encoding and security
Encoding user-supplied text before showing it on a page is a basic defence against cross-site scripting. This tool is for conversion and learning; real websites should do the encoding in their templates or framework, which apply it automatically and consistently.
Frequently asked questions
What is the difference between an entity and a percent code?
Entities belong in HTML text; percent codes belong in URLs. Use the matching tool.
Does it encode all non-English letters?
Only the characters that matter to HTML are converted. Letters in other languages are valid as they are in UTF-8 pages.
Is it safe to paste code here?
Yes. Nothing is sent to a server.
Open the HTML Entity Encoder & Decoder →
Related guides and tools
URL Encoder & Decoder
Percent-encode text for safe use in web addresses and query strings, or decode %20 style text back to readable form.
Read the guide · Open the toolBase64 Encoder & Decoder
Encode text to Base64 or decode it back, including Unicode text in languages such as Tamil.
Read the guide · Open the toolJSON Formatter & Validator
Format, minify and validate JSON with readable error messages.
Read the guide · Open the tool