⌘

HTML Encoder

Encode the value you enter as html.

0Words
0Characters
0Sentences
0mReading time
Choose a file or fill the fields, then click Run tool.

About HTML Encoder

When you want to show a code snippet in a blog post, put user-supplied text into an HTML template, or paste markup into a CMS field that renders HTML, special characters must be escaped. Otherwise the browser treats them as tags. Writers, CMS editors and developers use this to make markup display as literal text.

How it works

The tool replaces exactly five characters. & becomes &amp;, < becomes &lt;, > becomes &gt;, the double quote becomes &quot; and the single quote becomes &#039;. Every other character, including accented letters and emoji, is left unchanged, because modern UTF-8 pages display them fine. There are no named entities like &copy; and no numeric conversion of other symbols. The escaping happens instantly in your browser. The result can be pasted into HTML text or attribute values.

How to use HTML Encoder

  1. Type or paste the text you want to process in the text box above.
  2. Select “Run tool” and check the result before copying or downloading it.

Worked example

Input: <a href="x?a=1&b=2">Tom's</a>. Output: &lt;a href=&quot;x?a=1&amp;b=2&quot;&gt;Tom&#039;s&lt;/a&gt;. Placed inside a paragraph, this displays the original link markup as visible text instead of creating a clickable link.

Tips for a better result

  • Run the encoder once only. Encoding twice turns &amp; into &amp;amp;, and readers then see the entity text on the page.
  • For a code sample, wrap the encoded output in pre and code tags so spacing and line breaks are kept.
  • Entity escaping alone does not make text safe inside script tags, inline event handlers or URLs. Those contexts need their own escaping.

Frequently asked questions

Why isn't the copyright sign turned into &copy;?

Only the five characters that have special meaning in HTML are escaped. Symbols like the copyright sign, accented letters and emoji are valid as-is on a UTF-8 page, so they pass through unchanged.

Is this enough to prevent XSS?

It covers text placed between tags and inside quoted attribute values. It does not protect JavaScript contexts, unquoted attributes or href values like javascript: links. Use your framework's context-aware escaping in real applications.

How do I reverse it?

Use an HTML decoder, which turns the entities back into characters. Note that decoding text from untrusted sources and then inserting it as HTML can reintroduce the very markup you escaped.

What to check

A formatted or parsed result is not proof that code is secure, correct or production-ready. Never paste production secrets.

Read the Privacy Policy for information about local processing, connected services and advertising.