HTML Escape and HTML Entities List

Escaping HTML means swapping the characters a browser reads as markup for entities: & becomes &amp;, < becomes &lt; and > becomes &gt;. Inside attribute values, quotes need escaping too. Paste text below to escape or unescape it, or search the symbol table and copy any entity as a name, number or CSS value.

The five characters that matter
CharacterEntityWhen it must be escaped
&&amp;Always in text, when it could start a reference
<&lt;Always in text content
>&gt;Good practice everywhere; required in a few contexts
"&quot;Inside attribute values wrapped in double quotes
'&#39; or &apos;Inside attribute values wrapped in single quotes

Updated

A two-way converter for whole blocks of text, plus a searchable list of the symbols people actually reach for: quotes, dashes, spaces, currency, maths, arrows, Greek letters and emoji. Every row copies four ways.

HTML entities list

HTML entity reference: code point, name, decimal, hex and CSS value
Code pointNameDecimalHexCSS contentGroup
U+0026&amp;&#38;&#x26;"\26"Must escape
U+003C&lt;&#60;&#x3C;"\3C"Must escape
U+003E&gt;&#62;&#x3E;"\3E"Must escape
U+0022&quot;&#34;&#x22;"\22"Must escape
U+0027&apos;&#39;&#x27;"\27"Must escape
U+00A0&nbsp;&#160;&#xA0;"\A0"Spaces and invisible
U+2002&ensp;&#8194;&#x2002;"\2002"Spaces and invisible
U+2003&emsp;&#8195;&#x2003;"\2003"Spaces and invisible
U+2009&thinsp;&#8201;&#x2009;"\2009"Spaces and invisible
U+00AD&shy;&#173;&#xAD;"\AD"Spaces and invisible
U+200D&zwj;&#8205;&#x200D;"\200D"Spaces and invisible
U+200C&zwnj;&#8204;&#x200C;"\200C"Spaces and invisible
U+2026&hellip;&#8230;&#x2026;"\2026"Punctuation
U+2013&ndash;&#8211;&#x2013;"\2013"Punctuation
U+2014&mdash;&#8212;&#x2014;"\2014"Punctuation
U+2018&lsquo;&#8216;&#x2018;"\2018"Punctuation
U+2019&rsquo;&#8217;&#x2019;"\2019"Punctuation
U+201C&ldquo;&#8220;&#x201C;"\201C"Punctuation
U+201D&rdquo;&#8221;&#x201D;"\201D"Punctuation
U+00AB&laquo;&#171;&#xAB;"\AB"Punctuation
U+00BB&raquo;&#187;&#xBB;"\BB"Punctuation
U+2022&bull;&#8226;&#x2022;"\2022"Punctuation
U+00B7&middot;&#183;&#xB7;"\B7"Punctuation
U+00A1&iexcl;&#161;&#xA1;"\A1"Punctuation
U+00BF&iquest;&#191;&#xBF;"\BF"Punctuation
U+00A7&sect;&#167;&#xA7;"\A7"Punctuation
U+00B6&para;&#182;&#xB6;"\B6"Punctuation
U+2020&dagger;&#8224;&#x2020;"\2020"Punctuation
U+2021&Dagger;&#8225;&#x2021;"\2021"Punctuation
U+2032&prime;&#8242;&#x2032;"\2032"Punctuation
U+2033&Prime;&#8243;&#x2033;"\2033"Punctuation
U+20AC&euro;&#8364;&#x20AC;"\20AC"Currency
U+00A3&pound;&#163;&#xA3;"\A3"Currency
U+00A5&yen;&#165;&#xA5;"\A5"Currency
U+00A2&cent;&#162;&#xA2;"\A2"Currency
U+00A4&curren;&#164;&#xA4;"\A4"Currency
U+20B9(no name)&#8377;&#x20B9;"\20B9"Currency
U+20BF(no name)&#8383;&#x20BF;"\20BF"Currency
U+20A9(no name)&#8361;&#x20A9;"\20A9"Currency
U+00D7&times;&#215;&#xD7;"\D7"Math
U+00F7&divide;&#247;&#xF7;"\F7"Math
U+00B1&plusmn;&#177;&#xB1;"\B1"Math
U+2260&ne;&#8800;&#x2260;"\2260"Math
U+2264&le;&#8804;&#x2264;"\2264"Math
U+2265&ge;&#8805;&#x2265;"\2265"Math
U+2248&asymp;&#8776;&#x2248;"\2248"Math
U+221E&infin;&#8734;&#x221E;"\221E"Math
U+2211&sum;&#8721;&#x2211;"\2211"Math
U+221A&radic;&#8730;&#x221A;"\221A"Math
U+2212&minus;&#8722;&#x2212;"\2212"Math
U+00BD&frac12;&#189;&#xBD;"\BD"Math
U+00BC&frac14;&#188;&#xBC;"\BC"Math
U+00BE&frac34;&#190;&#xBE;"\BE"Math
U+00B0&deg;&#176;&#xB0;"\B0"Math
U+2030&permil;&#8240;&#x2030;"\2030"Math
U+00B2&sup2;&#178;&#xB2;"\B2"Math
U+00B3&sup3;&#179;&#xB3;"\B3"Math
U+00B5&micro;&#181;&#xB5;"\B5"Math
U+2190&larr;&#8592;&#x2190;"\2190"Arrows
U+2191&uarr;&#8593;&#x2191;"\2191"Arrows
U+2192&rarr;&#8594;&#x2192;"\2192"Arrows
U+2193&darr;&#8595;&#x2193;"\2193"Arrows
U+2194&harr;&#8596;&#x2194;"\2194"Arrows
U+21D0&lArr;&#8656;&#x21D0;"\21D0"Arrows
U+21D2&rArr;&#8658;&#x21D2;"\21D2"Arrows
U+21D4&hArr;&#8660;&#x21D4;"\21D4"Arrows
U+21B5&crarr;&#8629;&#x21B5;"\21B5"Arrows
U+00A9&copy;&#169;&#xA9;"\A9"Symbols
U+00AE&reg;&#174;&#xAE;"\AE"Symbols
U+2122&trade;&#8482;&#x2122;"\2122"Symbols
U+2713&check;&#10003;&#x2713;"\2713"Symbols
U+2717&cross;&#10007;&#x2717;"\2717"Symbols
U+2605&starf;&#9733;&#x2605;"\2605"Symbols
U+2606&star;&#9734;&#x2606;"\2606"Symbols
U+2665&hearts;&#9829;&#x2665;"\2665"Symbols
U+2660&spades;&#9824;&#x2660;"\2660"Symbols
U+2663&clubs;&#9827;&#x2663;"\2663"Symbols
U+2666&diams;&#9830;&#x2666;"\2666"Symbols
U+260E&phone;&#9742;&#x260E;"\260E"Symbols
U+2640&female;&#9792;&#x2640;"\2640"Symbols
U+2642&male;&#9794;&#x2642;"\2642"Symbols
U+25CA&loz;&#9674;&#x25CA;"\25CA"Symbols
U+03B1&alpha;&#945;&#x3B1;"\3B1"Greek
U+03B2&beta;&#946;&#x3B2;"\3B2"Greek
U+03B3&gamma;&#947;&#x3B3;"\3B3"Greek
U+03B4&delta;&#948;&#x3B4;"\3B4"Greek
U+03C0&pi;&#960;&#x3C0;"\3C0"Greek
U+03BC&mu;&#956;&#x3BC;"\3BC"Greek
U+03C3&sigma;&#963;&#x3C3;"\3C3"Greek
U+03BB&lambda;&#955;&#x3BB;"\3BB"Greek
U+03A9&Omega;&#937;&#x3A9;"\3A9"Greek
U+0394&Delta;&#916;&#x394;"\394"Greek
U+1F600(no name)&#128512;&#x1F600;"\1F600"Emoji
U+1F44D(no name)&#128077;&#x1F44D;"\1F44D"Emoji
U+2764(no name)&#10084;&#x2764;"\2764"Emoji
U+1F680(no name)&#128640;&#x1F680;"\1F680"Emoji
U+2705(no name)&#9989;&#x2705;"\2705"Emoji
U+1F525(no name)&#128293;&#x1F525;"\1F525"Emoji
U+1F4E7(no name)&#128231;&#x1F4E7;"\1F4E7"Emoji
U+1F4CD(no name)&#128205;&#x1F4CD;"\1F4CD"Emoji

Why browsers need entities at all

An HTML parser reads < as the start of a tag and & as the start of a character reference. If a product name or a code sample contains those characters, the browser may hide part of the text, merge it with the next tag, or in the worst case run injected markup. Escaping them tells the parser to show the character instead of acting on it.

The rule of thumb: escape &, < and > in text, and also escape the quote character inside attribute values. Everything else is a matter of convenience or encoding.

Entities in CSS and JavaScript

HTML entities only work in HTML. In a stylesheet, a character is written as a backslash followed by its hex code, which is why the table gives a CSS column for pseudo-element icons and custom bullets. In JavaScript strings the equivalent is \u followed by four hex digits, or \u{...} for characters beyond U+FFFF such as emoji.

If you set text with textContent in JavaScript, never escape it first: the browser treats it as plain text already, and escaping would show the entity literally.

How it works

  1. Paste text or markup into the box and pick Escape or Unescape. The result updates as you type.
  2. Tick Attribute mode when the text is going inside an attribute value, so quotes are escaped too.
  3. Tick Encode non-ASCII if the file will be saved or sent in an encoding other than UTF-8; every accented letter and symbol becomes a numeric reference.
  4. Search the table by name, symbol or group, then click Name, Number, CSS or JS to copy that form.

Tips

  • Escape at the moment you put text into HTML, not when you store it. Storing pre-escaped text leads to double escaping like &amp;amp; later.
  • Frameworks such as React escape text content for you. You only need manual escaping when you build HTML strings by hand.
  • A non-breaking space (&nbsp;) keeps two words on the same line, for example a number and its unit. Do not use runs of them for layout; use CSS margins instead.
  • In CSS, the content property takes a backslash and the hex code, so a right arrow is content: "\2192". Add a space after the code if the next character is a hex digit.

Frequently asked questions

What is the difference between a named and a numeric entity?

Both produce the same character. A named reference like &copy; is easier to read; a numeric one like &#169; (decimal) or &#xA9; (hex) works for every Unicode character, including the many that have no name. HTML defines about 2,200 names.

Do I still need entities if my page is UTF-8?

Only for the characters that have a meaning in markup: &, < and, inside attributes, the quote you used. With a UTF-8 page you can type symbols such as €, é or → directly. Entities for those are optional and mostly help when an editor or email system mangles non-ASCII text.

Is &apos; valid HTML?

Yes, in HTML5. It was missing from HTML 4, which is why older code uses &#39; instead. Both work in every current browser, and the escape option on this page outputs &#39; for the widest compatibility.

Is escaping HTML enough to stop XSS?

It stops injected text from becoming markup in normal element content and quoted attributes. It does not make a value safe inside a script block, an inline event handler, a style attribute or a URL such as href, which each need their own encoding or validation. Use your framework's built-in escaping and avoid building HTML from strings where you can.

Is my text sent anywhere?

No. Escaping and unescaping run in your browser, and nothing you paste leaves the page.

Related: URL encoder and decoder, URL parser, Markdown to HTML converter, HTML comments, line breaks and spaces, HTML viewer.

Start a 7-day free trial or see all free tools. On We.Inc you get a 7-day free trial, not a free plan: card needed, $0 today, cancel before it ends and you pay nothing. AI building is on paid plans from $20 a month.

More in Free Tools

Product

Who It's For

Features

Resources

Company

View Sitemap