Encode and Decode HTML Entities
Escape text so it can be shown safely inside HTML, or turn entity-filled markup such as <p> back into readable characters. Choose named or numeric references and how much to encode.
How to encode or decode HTML entities
- Choose the direction: Encode text → entities or Decode entities → text.
- Paste your text or click Sample.
- When encoding, pick which characters to encode and whether to prefer named entities or hexadecimal references.
- Copy or download the result, or click "Swap input and output" to reverse it.
Benefits
- Encoding only the five special characters is enough to prevent text from being parsed as markup.
- Decodes named, decimal and hex references, including numeric references without a trailing semicolon.
- Reports entity names it does not recognise instead of silently mangling them.
Limitations
- The built-in table covers about 300 common named entities; rarer HTML5 names are decoded through the browser's parser when that option is on.
- Escaping protects HTML text and quoted attributes only — it is not sufficient inside <script>, style or URL contexts.
Privacy and security
Encoding and decoding use this tool's own entity table in your tab. The optional fallback parses only the unknown entity text with DOMParser and never inserts it into the page.
Read our privacy policy for details about the site as a whole.
Frequently asked questions
Which characters must be escaped in HTML?
In text content, & and < are essential; > is escaped for symmetry. Inside attribute values, also escape the quote character that delimits the value — this tool escapes both " and '.
Named or numeric entities — which is better?
Both are equivalent in modern browsers. Named entities like é are easier to read, while numeric ones like é work for every Unicode character and in XML.
Do I need to encode accented letters?
Not if your page is served as UTF-8, which is the default for HTML5. Encoding all non-ASCII is mainly useful for systems that only accept ASCII.