My Tool Studio
Developer

HTML Encoder / Decoder

This HTML encoder decoder turns characters like <, >, & and quotes into HTML entities, and turns entities back into plain text. Encode escapes & < > and, with Escape quotes ticked, " and '. Non-ASCII as can also write accented letters, symbols and emoji as named entities such as &eacute; or as decimal or hex references, and Every character turns all text into numeric references. Decode understands every named entity browsers know, plus decimal and hex references including emoji, and can undo double encoding like &amp;amp;. Turn on Live mode to convert as you type, and search the built-in reference to copy any of 215 common entities. Tags in the input stay as text and nothing is run.

Always freeNo sign upRuns in your browser
Output appears here...
HTML entity reference (215 of 215)
CharNamedDecimalHex
"&#x22;
&&#x26;
'&#x27;
<&#x3C;
>&#x3E;
(space)&#xA0;
¡&#xA1;
¢&#xA2;
£&#xA3;
¤&#xA4;
¥&#xA5;
¦&#xA6;
§&#xA7;
¨&#xA8;
©&#xA9;
ª&#xAA;
«&#xAB;
¬&#xAC;
­&#xAD;
®&#xAE;
¯&#xAF;
°&#xB0;
±&#xB1;
²&#xB2;
³&#xB3;
´&#xB4;
µ&#xB5;
&#xB6;
·&#xB7;
¸&#xB8;
¹&#xB9;
º&#xBA;
»&#xBB;
¼&#xBC;
½&#xBD;
¾&#xBE;
¿&#xBF;
À&#xC0;
Á&#xC1;
Â&#xC2;
Ã&#xC3;
Ä&#xC4;
Å&#xC5;
Æ&#xC6;
Ç&#xC7;
È&#xC8;
É&#xC9;
Ê&#xCA;
Ë&#xCB;
Ì&#xCC;
Í&#xCD;
Î&#xCE;
Ï&#xCF;
Ð&#xD0;
Ñ&#xD1;
Ò&#xD2;
Ó&#xD3;
Ô&#xD4;
Õ&#xD5;
Ö&#xD6;
×&#xD7;
Ø&#xD8;
Ù&#xD9;
Ú&#xDA;
Û&#xDB;
Ü&#xDC;
Ý&#xDD;
Þ&#xDE;
ß&#xDF;
à&#xE0;
á&#xE1;
â&#xE2;
ã&#xE3;
ä&#xE4;
å&#xE5;
æ&#xE6;
ç&#xE7;
è&#xE8;
é&#xE9;
ê&#xEA;
ë&#xEB;
ì&#xEC;
í&#xED;
î&#xEE;
ï&#xEF;
ð&#xF0;
ñ&#xF1;
ò&#xF2;
ó&#xF3;
ô&#xF4;
õ&#xF5;
ö&#xF6;
÷&#xF7;
ø&#xF8;
ù&#xF9;
ú&#xFA;
û&#xFB;
ü&#xFC;
ý&#xFD;
þ&#xFE;
ÿ&#xFF;
Œ&#x152;
œ&#x153;
Š&#x160;
š&#x161;
Ÿ&#x178;
ƒ&#x192;
ˆ&#x2C6;
˜&#x2DC;
Α&#x391;
Β&#x392;
Γ&#x393;
Δ&#x394;
Θ&#x398;
Λ&#x39B;
Π&#x3A0;
Σ&#x3A3;
Φ&#x3A6;
Ψ&#x3A8;
Ω&#x3A9;
α&#x3B1;
β&#x3B2;
γ&#x3B3;
δ&#x3B4;
ε&#x3B5;
θ&#x3B8;
λ&#x3BB;
μ&#x3BC;
π&#x3C0;
ρ&#x3C1;
σ&#x3C3;
τ&#x3C4;
φ&#x3C6;
ψ&#x3C8;
ω&#x3C9;
(space)&#x2002;
(space)&#x2003;
(space)&#x2009;
(space)&#x200C;
(space)&#x200D;
(space)&#x200E;
(space)&#x200F;
–&#x2013;
—&#x2014;
‘&#x2018;
’&#x2019;
‚&#x201A;
“&#x201C;
”&#x201D;
„&#x201E;
†&#x2020;
‡&#x2021;
•&#x2022;
…&#x2026;
‰&#x2030;
′&#x2032;
″&#x2033;
‹&#x2039;
›&#x203A;
‾&#x203E;
⁄&#x2044;
€&#x20AC;
℘&#x2118;
ℜ&#x211C;
™&#x2122;
ℵ&#x2135;
←&#x2190;
↑&#x2191;
→&#x2192;
↓&#x2193;
↔&#x2194;
↵&#x21B5;
⇐&#x21D0;
⇒&#x21D2;
⇔&#x21D4;
∀&#x2200;
∂&#x2202;
∃&#x2203;
∅&#x2205;
∇&#x2207;
∈&#x2208;
∉&#x2209;
∏&#x220F;
∑&#x2211;
−&#x2212;
√&#x221A;
∝&#x221D;
∞&#x221E;
∠&#x2220;
∧&#x2227;
∨&#x2228;
∩&#x2229;
∪&#x222A;
∫&#x222B;
∴&#x2234;
∼&#x223C;
≅&#x2245;
≈&#x2248;
≠&#x2260;
≡&#x2261;
≤&#x2264;
≥&#x2265;
⊂&#x2282;
⊃&#x2283;
⊆&#x2286;
⊇&#x2287;
⊕&#x2295;
⊗&#x2297;
⊥&#x22A5;
⋅&#x22C5;
◊&#x25CA;
♠&#x2660;
♣&#x2663;
♥&#x2665;
♦&#x2666;

How to use

01

Paste text or HTML

Put the text you want to escape, or markup that contains entities, in the Input pane, or click Open file. Try sample loads a link with an ampersand, quotes, a copyright sign and an emoji.

02

Choose options, then Encode or Decode

Set Encode, Non-ASCII as and Escape quotes, then click Encode. Click Decode to turn entities back into characters, and tick Decode double-encoded text for strings like &amp;amp;. Live mode converts as you type.

03

Copy, download or look up an entity

Copy the output or download it. To find one entity, type a name, character or number into the reference search and click the named or decimal form to copy it.

Why HTML Encoder / Decoder

Common HTML entities cheat sheet

The first five rows are the characters you must escape in HTML text and attributes. The rest are optional in a UTF-8 page, but entities are handy when your editor, email tool or database mangles special characters.

Named entities are easier to read in source code. Numeric references work for any Unicode character, even ones without a name, such as the rupee sign (&#8377;). Note that &apos; is valid in HTML5 and XML but not in old HTML 4, which is why this encoder writes &#39; for a single quote unless you choose &apos;.

CharacterNamed entityNumeric
&&amp;&#38;
<&lt;&#60;
>&gt;&#62;
"&quot;&#34;
'&apos;&#39;
Non-breaking space&nbsp;&#160;
©&copy;&#169;
®&reg;&#174;
™&trade;&#8482;
€&euro;&#8364;
£&pound;&#163;
×&times;&#215;
°&deg;&#176;
…&hellip;&#8230;

Encoding modes compared

The Encode and Non-ASCII as settings decide how much of the text turns into entities. Here is what each choice does to the input Café & "tea":

SettingOutput
Special characters, non-ASCII left as isCafé &amp; &quot;tea&quot;
Special characters, non-ASCII namedCaf&eacute; &amp; &quot;tea&quot;
Special characters, non-ASCII decimalCaf&#233; &amp; &quot;tea&quot;
Special characters, non-ASCII hexCaf&#xE9; &amp; &quot;tea&quot;
Every character (numeric)&#67;&#97;&#102;&#233;&#32;&#38;... for every character

Common questions

What is the difference between HTML encoding and URL encoding?
HTML encoding replaces characters with entities like &lt; so a browser shows them as text inside a page. URL encoding replaces characters with %XX escapes so they are safe inside a web address. A space stays a space in HTML but becomes %20 in a URL.
What is the HTML entity for a non-breaking space or the copyright sign?
A non-breaking space is &nbsp; or &#160;, and the copyright sign is &copy; or &#169;. Paste either into the input and click Decode to check. The entity reference under the tool lists many more, each with a Copy button.
Does HTML encoding prevent XSS on its own?
Only in the right place. Encoding & < > " and ' makes text safe inside element content and quoted attributes. It is not enough inside a script block, a style block, an unquoted attribute or a URL such as a javascript: link, so also use your framework's escaping and a Content Security Policy.
Should I use named or numeric HTML entities?
Both work in every modern browser. Named entities like &eacute; are easier to read, while numeric ones like &#233; also work in XML, which defines only five named entities. If your page is saved as UTF-8 you rarely need either for accented letters; only & < > and quotes must be escaped.
Why does my page show &amp;amp; instead of &?
The text was encoded twice. The first pass turned & into &amp;, and the second turned the & at the start of &amp; into &amp; again. Tick Decode double-encoded text and click Decode to get back to the original in one step, then make sure your code escapes the text only once.
Which characters does the HTML encoder replace?
& becomes &amp;, < becomes &lt; and > becomes &gt;. With Escape quotes ticked, the default, a double quote becomes &quot; and a single quote becomes &#39; or &apos;. Everything else is left alone unless you set Non-ASCII as, or choose Every character to write the whole text as numeric references.
Does HTML decoding handle emoji written as numeric entities?
Yes. &#128512; and &#x1F600; both decode to the grinning face emoji. Simple decoders sometimes split such characters into two broken halves, but this one uses the browser's own HTML parser, so they come out whole.
Can the HTML decoder run scripts or load images from my input?
No. Decoding happens inside a detached text area element, which treats everything as plain text. Tags such as script or img stay as literal text in the output and are never run or fetched.
Can this tool format or validate HTML?
No. It only converts characters and entities. To indent markup use the HTML Beautifier, and to shrink it use the HTML Minifier.
When should I turn off quote escaping in the HTML encoder?
When the text goes between tags rather than inside an attribute. Quotes are harmless in element content, so leaving them unescaped keeps the output easier to read. Keep Escape quotes ticked for anything that ends up inside an attribute value.

More Developer tools

View all