An HTML entity encoder converts characters that have special meaning in HTML — such as <, >, &, and quotes — into safe entity codes like <, and a decoder turns those entities back into the original text. The tool above does both directions in your browser: switch mode, paste your text or markup, and copy the result. Nothing you paste is transmitted anywhere.
What is an HTML entity?
An HTML entity is a short code that stands in for a character the browser would otherwise interpret as part of the page structure. Because < opens a tag and & begins an entity, you cannot simply type them inside content and expect them to appear literally. Entities solve this: < renders as a less-than sign, & renders as an ampersand, and the markup stays intact.
Entities come in two forms. Named entities use a keyword — © for ©, — for an em dash — and are limited to a fixed list. Numeric entities reference a character by its Unicode code point, in decimal (©) or hexadecimal (©), and can represent any character at all.
Which characters need encoding?
Five characters are the essential set. Encoding the ampersand first is critical, because every other entity itself starts with one.
| Character | Encoded as | Why |
|---|---|---|
| & | & |
Starts every entity; must be escaped first |
| < | < |
Opens an HTML tag |
| > | > |
Closes an HTML tag |
| “ | " |
Ends a double-quoted attribute value |
| ‘ | ' |
Ends a single-quoted attribute value |
A worked example
Say you want to show the text Tom & Jerry <3 inside a page. Typed directly, the browser would try to read <3 as the start of a tag and swallow it. Encoded, it becomes Tom & Jerry <3, which the browser renders back as the exact characters you intended. Paste it into the decoder here and you get the original string returned unchanged.
Common use cases
- Displaying code on a web page — showing snippets of HTML, XML, or JSX as text rather than having the browser run them.
- Preventing injection — escaping user-supplied content before it is inserted into a page so it cannot introduce unwanted markup or script.
- Email and legacy systems — encoding accented letters and symbols as numeric entities so they survive channels restricted to plain ASCII.
- Debugging — decoding an entity you found in a page or feed to see which character it actually represents.
Common mistakes
- Double-encoding — encoding already-encoded text turns
&into&amp;. If a rendered page shows stray entity codes, decode once to recover. - Forgetting attribute quotes — a raw quote inside an attribute value silently ends it early; escape it as
"or'. - Encoding the ampersand last — do it first, or it will mangle the entities you just created.
When to reach for this tool
Most templating frameworks auto-escape interpolated values, so you seldom encode by hand in application code. This tool is for the gaps: hand-written HTML and email templates, attribute values you assemble as strings, static content, and any time you need to inspect or reverse an entity quickly. Because it uses the browser’s native parser for decoding and a straightforward character map for encoding, the results match exactly what a real browser would produce — and it all runs locally, with nothing you paste ever leaving your device.