HTML Entities

Encode special characters to HTML entities, or decode entities back to plain text. Private and browser-based.

Mode

How HTML Entities works

Encoding: the five characters that matter

To show text literally in HTML, such as a code sample, a user comment, or a string containing <, five characters must be escaped: & becomes &amp;, < becomes &lt;, > becomes &gt;, " becomes &quot;, and ' becomes &#39;. The ampersand is replaced first so existing text is never double-escaped by the tool itself.

Everything else, including accented letters and emoji, is left as is. Modern pages are served as UTF-8 and display those characters directly, so converting them to entities only makes the source harder to read. The result is safe both between tags and inside quoted attribute values.

Decoding

Decoding uses your browser's own HTML parser, so it understands every entity the browser does: all named entities such as &nbsp;, &eacute;, and &mdash;, decimal references like &#8212;, and hex references like &#x2014;. This is the quickest way to clean text scraped from web pages or exported from a CMS, where &amp; and &#39; often end up in CSV cells.

A non-breaking space decodes to the U+00A0 character, which looks like a space but does not match a normal space in searches or comparisons. If matching fails after decoding, replace it with a regular space in Find & Replace.

What this is not

Escaping is the right defense when inserting text into HTML, but it is not a sanitizer for HTML you intend to render. To show user-written Markdown or HTML safely, sanitize the generated markup, as the Markdown Preview does with DOMPurify. For text going into URLs, use URL encoding instead.

Example

The tag is shown as text instead of becoming a link, and both kinds of quote are escaped.

Text
<a href="/search?q=R&D">Tom's "R&D" notes</a>
Encoded
&lt;a href=&quot;/search?q=R&amp;D&quot;&gt;Tom&#39;s &quot;R&amp;D&quot; notes&lt;/a&gt;

How to use HTML Entities

  1. 1

    Choose Encode or Decode.

  2. 2

    Paste the text or the entity-encoded HTML.

  3. 3

    Check the result.

  4. 4

    Copy it into your template, CMS, or data file.

When to use it

Code samples in articles

Escape HTML or XML snippets so they display as text inside a <pre> block.

Cleaning scraped data

Decode &amp;, &#39;, and &nbsp; left in titles and descriptions exported from websites.

HTML Entities questions

Why isn't é converted to &eacute;?

Only characters with special meaning in HTML are escaped. UTF-8 pages display é directly, so encoding it is unnecessary.

Can I decode &amp;amp; that was escaped twice?

Yes, by decoding twice: the first pass gives &amp;, the second gives &.

Does decoding run any HTML or scripts?

No. The text is decoded inside a textarea element, which never runs scripts or loads resources.

Questions about privacy, file size, or accounts are answered on the FAQ page.

Other tools in the same category

Search all tools