{"content":{"intro":"In HTML, a few characters have special meaning: \"<\" starts a tag and \"&\" starts an entity. To show them as normal text on a web page, they have to be written as HTML entities. This tool escapes text into entities and converts entities back into characters.","sections":[["The five characters that get encoded","&amp; becomes &amp;amp;, &lt; becomes &amp;lt;, &gt; becomes &amp;gt;, the double quote becomes &amp;quot; and the single quote becomes &amp;#39;. The ampersand is handled first, so the entities themselves aren't encoded twice."],["When you need it","Use it when showing code examples on a web page or in a blog post, or when placing text inside an HTML attribute. Escaping is also part of how websites prevent HTML injection, although real applications should rely on their framework's built-in escaping rather than doing it by hand."],["What decoding covers","Decoding converts the common entities, &amp;amp;, &amp;lt;, &amp;gt;, &amp;quot;, &amp;#39;, &amp;apos; and &amp;nbsp;, back into characters. Less common named entities such as &amp;copy; are left as they are."]],"faqs":[{"q":"Why does my text show \"&amp;amp;amp;\"?","a":"It was encoded twice. Decode it once and it will return to a single encoded ampersand; decode again to get the plain character."},{"q":"Do accented letters need to be encoded?","a":"Not on a modern page saved as UTF-8. Only the five special characters need escaping, so this tool leaves other characters unchanged."}]},"copy":{"explain":"Encoding swaps the five characters that have meaning in HTML, &amp; &lt; &gt; &quot; ', for safe entities, and can optionally encode every non-ASCII character as a numeric entity or turn line breaks into &lt;br&gt;. Decoding converts every named and numeric entity back into characters.","example":"&lt;p class=&quot;note&quot;&gt;Fish &amp; chips&lt;/p&gt; → &amp;lt;p class=&amp;quot;note&amp;quot;&amp;gt;Fish &amp;amp; chips&amp;lt;/p&amp;gt;. Switch on &quot;Also encode non-ASCII&quot; and é becomes &amp;#233;. In Decode mode, &amp;copy; &amp;rarr; &amp;#8377; become © → ₹.","intro":"In HTML, a few characters have special meaning: &quot;&lt;&quot; starts a tag and &quot;&amp;&quot; starts an entity. To show them as normal text on a web page, they have to be written as HTML entities. This tool escapes text into entities and decodes any entity, named or numeric, back into characters, as you type.","sections":[["The five characters that get encoded","&amp; becomes &amp;amp;, &lt; becomes &amp;lt;, &gt; becomes &amp;gt;, the double quote becomes &amp;quot; and the single quote becomes &amp;#39;. The ampersand is handled first, so the entities themselves aren't encoded twice."],["When you need it","Use it when showing code examples on a web page or in a blog post, or when placing text inside an HTML attribute. Escaping is also part of how websites prevent HTML injection, although real applications should rely on their framework's built-in escaping."],["What decoding covers","Every named entity browsers understand, from &amp;amp; and &amp;nbsp; to &amp;copy;, &amp;rarr; and &amp;hellip;, plus numeric ones like &amp;#8377; and &amp;#x20B9;. The counter shows how many entities were found."]],"faqs":[{"q":"Why does my text show &quot;&amp;amp;amp;&quot;?","a":"It was encoded twice. Decode it once and it will return to a single encoded ampersand; decode again to get the plain character."},{"q":"Do accented letters need to be encoded?","a":"Not on a modern page saved as UTF-8. If you're pasting into an old system that only accepts ASCII, switch on &quot;Also encode non-ASCII&quot;."}]},"feat":[["Escape and unescape","Turn < > & \" into entities and back, as you type."],["Named and numeric","Decodes &amp;, &#169; and &#x2764; alike."],["Safe to paste","Show code on a web page without it running."],["Copy either side","Grab the encoded or decoded text."]],"faqx":[{"q":"Which characters need to be escaped in HTML?","a":"Five characters can be read as code: &amp; becomes &amp;amp;, &lt; becomes &amp;lt;, &gt; becomes &amp;gt;, the double quote becomes &amp;quot; and the single quote becomes &amp;#39;. Encode mode replaces all five and shows how many it escaped."},{"q":"Why does code I paste into my blog post disappear?","a":"The browser treats anything inside &lt; and &gt; as a real HTML tag, so it runs or hides it instead of showing it. Encode the code first and paste the result, and readers will see the tags as text."},{"q":"What's the difference between named and numeric entities?","a":"A named entity uses a word, like &amp;copy;, while a numeric one uses the character's Unicode number in decimal (&amp;#169;) or hex (&amp;#xA9;). All three show ©. Decode mode understands both kinds, but not every character has a name."},{"q":"What is the HTML code for the rupee symbol ₹?","a":"The rupee sign is Unicode U+20B9, so it is written &amp;#8377; in decimal or &amp;#x20B9; in hex. Most modern pages can include ₹ directly in UTF-8, but switch on &quot;Also encode non-ASCII&quot; if you need the numeric form."},{"q":"What is &amp;nbsp; and what does it decode to?","a":"&amp;nbsp; is a non-breaking space, character 160, also written &amp;#160;. It looks like a normal space but stops a line from breaking there, which keeps things like &quot;₹ 500&quot; together. Decoding turns it into that special space, not an ordinary one."},{"q":"How do I keep line breaks when showing text on a web page?","a":"HTML ignores ordinary line breaks, so separate lines run together. In Encode mode, switch on &quot;Keep line breaks as &lt;br&gt;&quot; and a &lt;br&gt; tag is added at the end of each line, so the text keeps its layout."},{"q":"Does escaping HTML protect a site from script injection?","a":"Escaping user text before adding it to a page is a key defence against cross-site scripting, because a &lt;script&gt; tag becomes harmless &amp;lt;script&amp;gt;. Text placed inside JavaScript or link addresses needs its own escaping, so this is not the only step."},{"q":"How is an emoji written as an HTML entity?","a":"Use its Unicode code point in decimal or hex. The waving hand 👋 is U+1F44B, so it becomes &amp;#128075; or &amp;#x1F44B;. With &quot;Also encode non-ASCII&quot; on, each emoji becomes one numeric entity like this."},{"q":"Why does it use &amp;#39; instead of &amp;apos; for apostrophes?","a":"&amp;apos; was not part of HTML 4, so older browsers and some email programs do not recognise it. &amp;#39; works everywhere and shows the same apostrophe. Decode mode reads both forms."}]}