← All Tools

HTML Encoder🔒 100% local

Encode text as HTML entities. Privacy-first, no server uploads.

HTML Encoder: related tools

HTML DecoderHTML EscapeHTML to JSX

Takes text that is headed for an HTML document and swaps the five characters HTML treats as markup - the ampersand, both angle brackets and both straight quotes - for their character references, so a fragment displays as written instead of being read as markup. The ampersand is substituted first, so an entity the tool has just produced is not escaped a second time. The whole chain of replacements runs in this tab, so the fragment is never uploaded.

HTML Encoder: how to use it

  1. Paste the fragment that is headed for a page into the Input box.
  2. Press Encode.
  3. Copy from the Output box, or press Clear to start again.
  4. Paste the result where the text should appear as text, not where markup is expected.

HTML Encoder: worked example

<div class="test">Hello & World</div>becomes&lt;div class=&quot;test&quot;&gt;Hello &amp; World&lt;/div&gt;

Computed by running the shipped HtmlEncoderLogic: the ampersand is replaced first, so the entity it produces is left alone by the later rules.

AT&T <Tom> says "hi"becomesAT&amp;T &lt;Tom&gt; says &quot;hi&quot;

Apostrophes become &#39; as well, which is why a contraction in prose comes back looking heavier than the surrounding text.

HTML Encoder: when to use it

HTML Encoder: what it does not do