HTML Entity Encoder
And Decoder

Escape markup for pasting, decode it back. Encodes to named, decimal or hex entities, escapes just the five special characters, all non-ASCII text or every character, and decodes every entity in the HTML standard using your browser's own parser. 100% client-side. Zero data stored.

HTML Entity Encoder illustration: the text <p>Tom & "Jerry"</p> becoming its entity-encoded form and back

HTML Entity Encoder Tool

Encoding options

Named output falls back to a decimal number for a character with no standard name. The apostrophe is written as &#39; unless you choose &apos;, which HTML 4 does not define.

Common Use Cases

Show code in a web page

Paste a snippet of HTML into documentation or a blog post without the browser treating it as real markup.

CMS and email templates

Fix quotes, ampersands and accented letters before pasting into a CMS field or an email template that mangles them.

Attribute values

Put text containing quotes into a title, alt or data attribute without ending the attribute early.

Read scraped or exported text

Turn text full of &amp;, &#8217; and &nbsp; back into readable characters after a scrape, a feed or a database export.

ASCII-only systems

Encode every non-ASCII character so text survives an old system, an ASCII-only config file or a tool with no UTF-8 support.

Debug double encoding

Spot text that was encoded twice (&amp;amp;) by decoding it one level at a time, and find references a browser would repair or ignore.

Entity Reference

The five characters that must be escaped in HTML
Character Named Decimal Hex Escape it when
&&amp;&#38;&#x26;Always. An ampersand starts every entity, so a bare one can be misread.
<&lt;&#60;&#x3C;In text and attribute values. It starts a tag.
>&gt;&#62;&#x3E;Good practice in text; harmless to escape everywhere.
"&quot;&#34;&#x22;Inside a double-quoted attribute value.
'&apos; (HTML5, XML)&#39;&#x27;Inside a single-quoted attribute value. Prefer the number: HTML 4 has no &apos;.

Named, decimal, hex

All three mean the same character: &copy;, &#169; and &#xA9; are each the copyright sign. Names are easiest to read; numbers work for every character, including the thousands that have no name.

Decoding is exact

The decoder is your browser's own HTML parser, so it knows all 2,125 names in the HTML standard, including ones that decode to two characters and old names written without a semicolon. The table below lists the most common 253.

Numbers a browser repairs

&#0;, surrogates and anything above U+10FFFF become U+FFFD, and &#128; to &#159; are read as Windows-1252, so &#150; is an en dash. The decoder shows each one it finds so you can fix the source.

What this tool is not

It escapes text for HTML content and attributes. It is not a security filter: script blocks, style blocks and URLs follow different rules, so use an auto-escaping template engine for anything that handles untrusted input.

Do you need to encode accents?

Not on a modern page: save the file as UTF-8, declare it, and write the characters directly. Encode non-ASCII only for systems that cannot carry UTF-8 reliably.

Line breaks in decoded text

As in any HTML document, the parser reads a Windows line break as a single line feed, so decoded text always uses LF line endings.

Common named entities

Common named HTML entities with their decimal and hex forms
Char Named (click to copy) Decimal Hex Description

Frequently Asked Questions

Why We Built This HTML Entity Encoder

Sooner or later every web page meets a character it cannot carry: an ampersand in a company name, a quote inside an attribute, a snippet of HTML that has to be shown rather than run, or a block of text that arrives full of &amp; and &#8217;. Most entity tools do half the job, with a short list of names that misses most of the standard and a decoder that gives up on anything it was not taught. We built this one to do both directions properly.

Encoding lets you choose exactly how much to escape and in what style, and keeps existing entities from being encoded twice. Decoding hands the work to your browser's own HTML parser, in a detached text box where nothing becomes markup, so every name in the standard works and the odd cases, such as old Windows-1252 numbers and names without a semicolon, behave exactly as they would on a real page. Everything happens in your browser, so your text never leaves your device.

The HTML Entity Encoder is part of RJL.io's collection of free developer tools. For other encodings, try the URL Encoder, the Base64 Encoder and the SVG URL Encoder, tidy markup with Pretty Print, or test a pattern against your text with the Regex Tester.

Is your site ready for Google and AI search?

The free SEO Analyzer checks any page in seconds - meta tags, structured data, AI crawler access - and tells you exactly how to fix each issue on your platform.