TapCub is live — analytics, insights and live chat, free on one platform

Free tool HTML encoder and HTML entity decoder

Show a snippet of code on a page without the browser running it, or turn <, " and ' back into the characters they stand for. Decoding follows the HTML standard, including the cases browsers forgive.

  • Escape or unescape
  • Full named-entity table
  • Runs locally
Encoder

Escape or unescape HTML

The sample is a link you might want to show in a blog post as code. Try the second sample: a tracking snippet that a rich-text editor escaped, which is why it never ran.

Everything in the box is converted at once.

Result
<a href="/pricing?plan=pro&utm_source=blog">See "Pro" plans & prices</a>

Entities

10

Converted in this run.

Characters in

72

Characters out

112

Entities found

Each entity once, in order of appearance.

EntityCharacterCode pointCount
&lt;<U+003C2
&quot;"U+00224
&amp;&U+00262
&gt;>U+003E2
Runs entirely in your browser. Nothing you type here is uploaded or stored by TapCub.

Share these inputs: the values go after the # in the link, so they never reach a server.

Version v1.0Updated Update history

Read the result

What the entities mean

An entity, properly a character reference, is a way to write a character that would otherwise be read as markup or could not be typed.

The five that matter

& starts an entity and < starts a tag, so both must be escaped in text. > is escaped for symmetry. Inside an attribute, escape the quote that delimits it: &quot; or &#39;.

Named or numeric

Named references such as &copy; are easier to read. Numeric ones, &#169; or &#xA9;, work for every character, including Chinese and emoji, which have no names.

Forgiving decoding

Browsers decode 106 old names such as &amp and &copy even without the semicolon, and read &#150; as an en dash. The checks list each case so you can fix the source.

Double escaping

If the result still shows &lt;, the text went through escaping twice, often once by an editor and once by a template. Decode again, then find where the extra step happens.

Escaping for HTML text is not the same as escaping for a URL, a JavaScript string or CSS. Each context has its own rules; use the URL encoder for links.

How to use it

Three steps

Encode before code goes onto a page; decode when you need to read it.

  1. 1

    Pick the mode

    Encode to show code as text. Decode to read text full of &…;.

  2. 2

    Choose the scope

    For HTML pages, "Only & < > and quotes" is enough, since UTF-8 pages can carry any character. Numeric output suits old systems and email templates that mangle non-ASCII text.

  3. 3

    Check the warnings

    Missing semicolons, unknown names and double escaping are listed with line numbers, so you can fix the source rather than the symptom.

Rules

Common characters and their references

The HTML standard defines 2,231 named character references, 106 of which also work without a semicolon for historical reasons. Any character can also be written as a decimal or hex code point.

  • Decoding takes the longest matching name: &notin; is ∉, but &notit; is ¬ followed by "it;"
  • &#0;, surrogates and values above U+10FFFF become U+FFFD; 128–159 map to windows-1252 characters
  • This page uses the WHATWG values: &lang; is U+27E8, not U+2329 as in HTML 4
  • Attribute values have one extra rule (no decoding before = or a letter) that this tool does not apply
Frequently used characters with named, decimal and hex references
CharacterNamedDecimalHexNotes
&&amp;&#38;&#x26;Always escape in text
<&lt;&#60;&#x3C;Always escape in text
>&gt;&#62;&#x3E;Escaped by convention
"&quot;&#34;&#x22;In double-quoted attributes
'&apos;&#39;&#x27;&apos; is not in HTML 4
(no-break space)&nbsp;&#160;&#xA0;Not equal to a normal space
©&copy;&#169;&#xA9;Works without ; too
—&mdash;&#8212;&#x2014;
中—&#20013;&#x4E2D;No name; numeric only
Worked example

Six inputs browsers decode differently than you might expect

Each row was checked against Python’s html.unescape, which implements the same HTML5 rules.

Decoding results for tricky inputs
InputDecodes toWhy
&amp;lt;&lt;Escaped twice: one decode leaves an entity behind
&copy2026©2026Legacy name, semicolon optional
&notit;¬it;Longest match is the legacy name "not"
&#150;– (U+2013)150 is a C1 control; HTML maps it via windows-1252
&#0;� (U+FFFD)Null is never allowed
&lang;⟨ (U+27E8)HTML5 changed the value from HTML 4

Rows two to four are parse errors that browsers silently fix. A strict XML parser would reject them, which is why the same HTML can render in a browser yet break in an RSS reader or an email sender.

Common mistakes

Where HTML escaping goes wrong

Most bugs are escaping too little, too much, or in the wrong place.

Pasting code into a rich-text editor

Visual editors escape what you paste, so <script> becomes &lt;script&gt; and shows as text. Tracking and chat snippets go into the HTML or custom code field instead.

Escaping twice

A template escapes a value that was already escaped, and readers see &amp; on the page. Escape once, at output, and store raw text.

Assuming escaping stops all XSS

HTML escaping protects text and quoted attributes. It does not make a value safe inside href="javascript:…", a script block or an unquoted attribute.

Treating   as a space

A no-break space copied from a web page into a campaign name or event name does not equal a space, so it splits rows in reports and fails exact-match filters.

FAQ

HTML entity questions

Still have a question?

Chat with the team behind TapCub — we usually reply within a few hours on business days.

What is an HTML entity?

A character reference: text that starts with & and stands for one character. &lt; is <, &copy; is ©, &#20013; is 中. They let you write characters that would otherwise be read as markup, or that are hard to type.

Which characters must I escape in HTML?

In text, & and <; > is usually escaped as well. Inside an attribute value, also the quote character around it. On a UTF-8 page you do not need entities for accented letters, Chinese or emoji.

What is the difference between &#39; and &apos;?

Both mean an apostrophe. &apos; comes from XML and was only added to HTML in HTML5, so very old HTML parsers do not know it. &#39; works everywhere, which is why this tool uses it.

Why does my tracking code show up as text on the page?

It was escaped, usually by a rich-text editor, so the browser received &lt;script&gt; instead of a tag. Decode it here to check, then paste the original into your site’s HTML, header code or custom code field, not the visual editor.

Does escaping HTML prevent XSS?

It is the right defence for values placed in HTML text and quoted attributes. It is not enough inside URLs, inline scripts, styles or event handler attributes, which each need their own encoding or, better, a templating system that escapes by context.

How many named entities are there?

The HTML standard lists 2,231 named character references. 2,125 are distinct names ending in a semicolon; the other 106 are legacy forms without it, such as &amp. Decoding here uses the whole list.

Is what I paste sent anywhere?

No. Everything runs in your browser. The share link stores the text after # in the address, which browsers do not send to servers, but anyone you give it to can read it.

Changelog

Update history

New features, fixes and data refreshes for this tool, newest first.

  1. · v1.0

    LaunchedFirst release.

Missing something or found an error? Tell us — requests that come up often go into the next update. All tool updates

See your data clearly. Find your growth.

Every click, backed by data. Install one line of code and see your first numbers in a minute.

No credit card · Free plans for analytics and chat · Cookieless analytics