SEO & Webmaster

HTML Entity Encoder / Decoder

Escape text for safe use in HTML, or turn entities such as & © € back into characters.

Text
HTML with entities

Common entities (click to insert)

About this tool

HTML entities are codes that stand for characters, such as &lt; for <, &amp; for & and &copy; for ©. They exist because a few characters have special meaning in HTML: a raw < starts a tag and a raw & starts an entity, so showing them as text, or putting user input into a page, requires escaping them. Entities also let you write characters that are hard to type, like a non-breaking space or an em dash.

This tool escapes text for safe use in HTML, either just the five special characters or every non-ASCII character too, using named (&eacute;), decimal (&#233;) or hexadecimal (&#xE9;) references. In the other direction it decodes all named and numeric entities, including emoji, using the browser's own HTML parser so every one of the 2,000+ HTML5 names is recognised.

How to use HTML Entity Encoder / Decoder

  1. Choose Encode or Decode.
  2. When encoding, choose the scope: only & < > " ' (enough for normal HTML), non-ASCII as well (for systems that mangle UTF-8), or all symbols.
  3. Pick named, decimal or hex format. Characters without a common name always use a numeric reference.
  4. Copy the result, or click Swap to run it back the other way. The table below inserts common entities with one click.

Examples

Escape HTML for display

Input
<a href="x">Tom & Jerry's</a>
Result
&lt;a href=&quot;x&quot;&gt;Tom &amp; Jerry&#39;s&lt;/a&gt;

The browser now shows the tag as text instead of creating a link.

Non-ASCII characters

Input
© café 😀
Result
&copy; caf&eacute; &#128512;

The emoji has no name, so a decimal reference is used.

Decode entities

Input
&lt;p&gt; &mdash; &#x1F600;
Result
<p> — 😀

When you need to escape HTML

  • Showing code or markup as text, for example in a tutorial or a <pre> block.
  • Inserting any user-provided text into a page. Unescaped input is the classic cause of cross-site scripting (XSS); frameworks such as React escape automatically, but templates that build HTML strings do not.
  • Putting text into an attribute value: a quote inside title="…" ends the attribute unless it is written as &quot;.
  • You do not need entities for accented letters or Chinese characters when the page is served as UTF-8, which is the default on the modern web. Writing é directly is perfectly fine.

Named, decimal or hexadecimal?

Named entities (&copy;) are the easiest to read but exist only for about 2,200 characters. Numeric references work for every Unicode character: decimal (&#169;) uses the code point in base 10, hexadecimal (&#xA9;) in base 16, matching how Unicode charts list it (U+00A9).

For the apostrophe, this tool writes &#39; rather than &apos;, because &apos; was not defined in HTML 4 and some older email clients still do not support it.

Frequently asked questions

Everything you need to know about this tool and data security.

What is &nbsp;?

A non-breaking space: it looks like a space but prevents a line break, for example between a number and its unit (10&nbsp;km). Do not use it for layout spacing; use CSS instead.

Is HTML escaping enough to prevent XSS?

It is enough for text placed between tags and inside quoted attribute values. Other contexts, such as JavaScript code, URLs in href or CSS, need their own encoding; prefer a framework or library that handles contexts for you.

Why does an entity stay unchanged when decoding?

Either it is not a real HTML entity (a typo such as &copyy;) or it lacks the final semicolon. The tool lists unknown entities under the result.

What is the difference from URL encoding?

HTML entities make text safe inside HTML; URL (percent) encoding makes text safe inside a URL, writing a space as %20. A link in HTML may need both: percent-encode the URL, then escape & as &amp; inside the href attribute.

Is my data safe when using this tool?

Yes, 100% safe. This tool operates entirely inside your web browser using client-side JavaScript and WebAssembly. Your data never touches any external server.