HTML Encoder

Escape HTML entities.

FreeNo accountOn your device

Runs in your browser. How to verify

Loading tool…

About this tool

Paste text or markup and get it with the five HTML-significant characters escaped: & < > " and '. Use it to show code in a page or to neutralise user text before putting it in HTML.

How to use

1
Step 1
Paste the text or HTML.
2
Step 2
Press Run.
3
Step 3
Copy the escaped text.

How it works

Each of the five characters is replaced by a named or numeric entity: & becomes &amp;, < becomes &lt;, > becomes &gt;, a double quote becomes &quot; and a single quote becomes &#39;. Other characters, including accented letters, are left as they are.

Worked example

Escaping a link

Input
<a href="x">Tom & Jerry's</a>
Output
&lt;a href=&quot;x&quot;&gt;Tom &amp; Jerry&#39;s&lt;/a&gt;
Walkthrough
Pasted into an HTML page, the output displays the tag text instead of making a link.

Limitations

  • Only the five characters above are escaped. Non-ASCII characters stay as they are.
  • It is an escaper for text nodes and quoted attributes, not a full HTML sanitizer.

Questions

How do I escape HTML characters?
Paste the text and press Run. & < > and both kinds of quotes are replaced with entities.
Does escaping prevent XSS?
It helps for text placed in an element or a quoted attribute, but it is not a substitute for a framework's escaping or a sanitizer.
Does it convert é to &eacute;?
No. Only the five special characters are encoded.
How do I reverse it?
Use the HTML decoder tool.

Features

  • Five-character escape
  • Named and numeric entities
  • Runs in your browser

Related resources

Guides and videos from around the web—opens on YouTube or the publisher’s site.

  • Learn JSON - Full Crash Course for Beginners

    freeCodeCamp.org

    Encoded blobs often wrap JSON payloads in transit.

    Watch on YouTube
  • TypeScript in 100 Seconds

    Fireship

    Typed JS snippets often get formatted or hashed nearby.

    Watch on YouTube
  • Base64

    MDN

    Glossary definition and when Base64 is appropriate versus binary transfer.

  • MDN Web Docs

    MDN

    Primary reference for web APIs these developer tools touch.