HTML Entity Encode and Decode
Convert special characters to HTML entities and decode HTML entities back to readable text.
HTML Entity Encode and Decode tool
Example
Input: <a href="x">Tom & Jerry</a>
Result: <a href="x">Tom & Jerry</a>
The characters that have special meaning in HTML are replaced by entities: < becomes <, > becomes >, & becomes & and " becomes ".
Characters the Encoder Escapes
| Character | Encoded as | Why it matters |
|---|---|---|
| & | & | Starts every entity |
| < | < | Opens a tag |
| > | > | Closes a tag |
| " | " | Ends a double-quoted attribute |
| ' | ' | Ends a single-quoted attribute |
| © é emoji | unchanged | Shown directly on UTF-8 pages |
- To encode, paste your text or HTML containing special characters into the HTML panel.
- To decode, paste text containing HTML entities (named, decimal, or hexadecimal) into the Encoded panel instead.
- The other panel updates instantly - encoding escapes &, <, >, double quotes, and apostrophes.
- Review the converted output and use the swap button if you want to run the result through again.
- Click the copy button to copy the encoded or decoded text for use in your HTML document.
HTML Entities: Escaping Special Characters
HTML entity encoding replaces characters that HTML treats as markup with safe codes. This tool turns & into &, < into <, > into >, " into " and ' into '. It also decodes entities back into the characters they stand for.
Browsers read < as the start of a tag. To show the text <script> on a page, for example in a code sample or a user comment, you have to write <script>. The same escaping is a key defense against cross-site scripting (XSS), where an attacker slips HTML into a page through a form or URL. Escaping these five characters in page text and quoted attribute values stops that input from turning into markup. The encoder changes only those five characters. Accented letters, symbols like © and emoji are left alone, since a page served as UTF-8 displays them directly. That keeps the output short and easy to read.
The decoder understands named entities such as © and , decimal codes such as © and hex codes such as ©, all three of which give ©. It works in a single pass, so &lt; becomes < and not <. That helps when you look at text that was escaped twice by mistake. For links, use URL Encode and Decode instead, since URLs use %XX codes, not entities.
Sources
Frequently Asked Questions
Related Tools
URL Encode and Decode
Encode special characters for URLs or decode percent-encoded strings back to readable text.
Developer ToolsBase64 Encode and Decode
Encode text to Base64 and decode Base64 strings back to readable text, with full UTF-8 support.
Developer ToolsHTML Minifier
Minify HTML by removing comments and collapsing whitespace between tags and inside tags to reduce document size.
Developer ToolsJSON Formatter and Validator
Format, validate, beautify, and minify JSON data with a collapsible tree view and line-and-column error detection.
Developer Tools