HTML Entity Encoder and Decoder

Encode the five HTML special characters as entities so text shows literally in a page, or decode named, decimal and hex entities back to characters.

Mode:
Paste your text and click Encode or Decode to convert HTML entities.

Quick Reference

Common HTML Entities

Entity NameCharacterHexDecimalDescription
&&&&Ampersand
&lt;<&#x3C;&#60;Less-than sign
&gt;>&#x3E;&#62;Greater-than sign
&quot;"&#x22;&#34;Double quotation mark
&#39;'&#x27;&#39;Single quotation mark
&nbsp; &#xA0;&#160;Non-breaking space
&copy;©&#xA9;&#169;Copyright sign
&reg;®&#xAE;&#174;Registered trademark
&trade;™&#x2122;&#8482;Trademark symbol
&euro;€&#x20AC;&#8364;Euro sign
&pound;£&#xA3;&#163;Pound sign
&mdash;—&#x2014;&#8212;Em dash
&ndash;–&#x2013;&#8211;En dash
&hellip;…&#x2026;&#8230;Horizontal ellipsis
&laquo; / &raquo;« / »&#xAB; / &#xBB;&#171; / &#187;Left/right angle quotes

Runs in your browser: your files and text are not uploaded. Free, no account needed.

Last updated: · Reviewed by the QuickTooly Team

Encoding Rules

Which Characters Get Encoded

Encode mode escapes only the characters that can break HTML markup, plus the non-breaking space:

  • & becomes &amp;, < becomes &lt; and > becomes &gt;.
  • " becomes &quot; and ' becomes the numeric &#39;.
  • A non-breaking space (U+00A0) becomes &nbsp;.

Everything else is left as it is, including ©, €, accented letters and emoji. A page served as UTF-8 displays these correctly without entities. Text that already contains entities is encoded again, so &amp; becomes &amp;amp;.

Named vs Numeric Entities

A named entity uses a word (&copy;). A numeric one uses the Unicode code point in decimal (&#169;) or hex (&#xA9;). All three give the same character. Numeric entities work for every Unicode character, while named ones exist only for the characters in the HTML list. This encoder uses the named form for &, <, >, " and the non-breaking space, and the numeric form for the apostrophe. (&apos; is valid in HTML5 and XML but was not defined in HTML 4.)

How Decoding Works

Decode mode lets the browser's HTML parser read the input and returns the resulting text. That means every named, decimal and hex entity the browser knows is converted. It also means any HTML tags in the input are removed rather than kept: <b>Hi</b> &amp; bye decodes to "Hi & bye". The input is parsed into a separate, inactive document, so scripts in it do not run and images in it are not loaded.

Where Encoding Matters

  • Showing code samples, such as <div>, as visible text in a page or blog post.
  • Putting user-supplied text inside HTML attributes, where an unescaped " ends the attribute.
  • Escaping is only one part of preventing XSS. In templates, use your framework's built-in escaping, and add context-specific escaping for URLs and JavaScript.

Frequently Asked Questions

Why is my © or é not encoded?

The encoder only escapes &, <, >, ", ' and the non-breaking space. Other characters display correctly in UTF-8 pages and are left unchanged.

Why did decoding remove my HTML tags?

The decoder reads the input as HTML and returns only its text, so tags are dropped. Encode first if you need to keep tags as visible text.

What does the Entities count show?

It counts entity patterns such as & or ' in the encoded output, or in the input when decoding.

Related Tools