130+ free tools. No sign-up. No hidden fees. Explore the toolkit

HTML Encoder & Decoder

Convert HTML special characters to safe entities — and back again — so code displays as text on a web page instead of being read as markup.

Type code to encode, or paste entities to decode. Nothing is uploaded.

Result

Save to Pinterest

How It Works

Web browsers read certain characters as instructions: < starts a tag, & starts an entity, and quotes delimit attributes. So to display the text <p>Hello</p> instead of rendering a paragraph, each special character must become an entity — &lt; for <, &gt; for >, &amp; for &, &quot; for quotes and &#39; for apostrophes. This tool converts in both directions.

Encoding also handles common named entities beyond the big five: the copyright sign becomes &copy;, the euro sign &euro;, the em dash &mdash;, and curly quotes become &ldquo;, &rdquo;, &lsquo; and &rsquo;. Decoding reverses all of them, including numeric entities such as &#39; and hexadecimal ones such as &#x27;. It is careful about order: &amp;lt; decodes to the literal text &lt;, not to <, because the ampersand is decoded last.

Worked Example

Encode <p class="hi">Tom & Jerry</p> and you get &lt;p class=&quot;hi&quot;&gt;Tom &amp; Jerry&lt;/p&gt; — every angle bracket, quote and ampersand replaced, so the whole string can be pasted into a web page and shown as code. Encode café — 50€ and you get café &mdash; 50&euro; — the dash and euro sign become named entities while the é stays as it is. Decode &lt;b&gt;Hi&lt;/b&gt; and you get <b>Hi</b> back.

How to Use This Tool

Paste your code or text into the box and press Encode Entities to convert it, or paste entity-filled text and press Decode Entities to reverse it. The result appears below with the character counts for the input and the output, and Copy Output copies the result to your clipboard.

Tips and Practical Advice

Last updated: