HTML Entity Encoder & Decoder
Encode special characters (&, <, >, ", ') as HTML entities, or decode entities back to readable text.
Decode HTML entities online
HTML entities are escaped text representations of characters that have special meaning in HTML. For example, & represents an ampersand, < represents a less-than sign, and " represents a double quote.
Use this HTML entity decoder when copied text contains escaped characters such as &, , ', or '. Paste into the entity panel to decode as you type, or click Decode to run the conversion again.
Encode characters as HTML entities
Encoding is useful when you want literal markup to appear as text instead of being interpreted by the browser. A code sample such as <button>Save</button> should be encoded before it is placed inside documentation, a CMS field, or a template example.
The encoder handles ampersands, less-than and greater-than signs, quotes, and apostrophes. Turn on Encode non-ASCII when you also need Unicode characters such as copyright signs, currency symbols, or emoji represented as entities.
Named, decimal, and hexadecimal output
Choose the entity style required by your template, documentation system, or test case. Named output uses readable references when available and falls back to a decimal code for other Unicode characters.
Named: ©
Decimal: ©
Hexadecimal: ©
Common HTML entities
& ampersand
< less-than sign
> greater-than sign
" double quote
' apostrophe
non-breaking space
JavaScript HTML entity decode workflow
In browser JavaScript, a common way to decode HTML entities is to assign encoded text to a detached textarea element and read its value. This works for named entities, decimal numeric entities, and hexadecimal numeric entities.
For a deeper walkthrough, read the guide on how to decode HTML entities online and in JavaScript.
FAQ
When should I encode HTML?
Encode text before inserting it into HTML source when you want characters such as < and & to display literally.
What characters are commonly escaped?
Ampersand, less-than, greater-than, double quote, apostrophe, and non-breaking spaces are the characters you will see most often in escaped HTML text.
How do I decode HTML entities in JavaScript?
In a browser, create a detached textarea, set its innerHTML to the encoded string, and read back the value. For untrusted HTML, decode text only and avoid inserting unknown markup into the live page.
Can entities help prevent XSS?
Escaping output is one important defense, but secure HTML rendering also depends on context-aware sanitization and safe templating.
What is the difference between named and numeric entities?
Named entities use readable names such as amp, while numeric entities use a character code such as #38 or #x26.