← All Tools

HTML Encoder🔒 100% local

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

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.

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.

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.

When to use it

What it does not do