Skip to content
Tezmy Tools

HTML Encoder & Decoder

Escape special characters as HTML entities, or turn entities back into text

80 characters

Runs in your browser. Nothing is uploaded.

About the HTML Encoder & Decoder

HTML treats characters such as <, > and & as part of its own syntax, so to show them as text on a web page you have to write them as entities: &lt;, &gt; and &amp;. This tool encodes text into safe HTML in one click and decodes entities back to normal characters. For encoding you can choose between escaping only the five special characters, or also turning every non-ASCII character such as é, € or an emoji into a numeric entity so the result is plain ASCII. Decoding understands named entities like &copy; and &hellip; and numeric ones like &#169; and &#xA9;.

Updated October 2026

How to use the HTML Encoder & Decoder

  1. 1Choose Encode or Decode at the top.
  2. 2Paste your text or HTML into the left box.
  3. 3For encoding, choose whether to escape only the special characters or all non-ASCII characters too.
  4. 4Read the result in the right box.
  5. 5Copy it and paste it where you need it.

Where encoding is used

  • Showing code samples inside an HTML page.
  • Putting user comments or names into a template safely.
  • Writing text into XML, RSS feeds or email templates.
  • Storing symbols in old systems that only accept plain ASCII.
  • Cleaning up text copied from a web page with visible entities such as &nbsp; and &amp;.

Common entities worth knowing

The five basics are &amp; for the ampersand, &lt; for less-than, &gt; for greater-than, &quot; for a double quote and &#39; for a single quote. Typographic favourites include &nbsp; for a non-breaking space, &copy; for ©, &euro; for €, &mdash; for a long dash, &hellip; for an ellipsis and &rarr; for an arrow.

If you are unsure whether to use a named or numeric entity, the numeric form is always valid, even for characters that have no name.

Related developer tools

Use the URL Encoder and Decoder for web addresses, the Base64 Encoder for binary data, the Escape and Unescape Text tool for JSON and string escapes, the HTML to Text tool to strip tags and the Markdown to HTML Converter for formatted content. For web addresses use URL Encoder & Decoder, and for binary-safe text the Base64 Encoder & Decoder.

Features

  • Encodes & < > " and ' as entities
  • Optional numeric entities for all non-ASCII characters
  • Decodes named, decimal and hexadecimal entities
  • Leaves unknown or invalid entities untouched
  • Character count of the result
  • Everything stays in your browser

Frequently asked questions

Why do I need to encode HTML?

If you place raw text containing < or & into a web page, the browser may read it as markup and display it wrongly or run it as code. Encoding turns those characters into entities so they are displayed as text. It is also a basic defence against script injection.

Which characters must be escaped in HTML?

The ampersand, the less-than sign and the greater-than sign always matter. Inside attribute values you also need to escape the double quote or single quote you used to wrap the value. This tool escapes all five to be safe.

What is the difference between &#169; and &copy;?

They both produce the copyright sign ©. &copy; is a named entity, easy to read. &#169; is a numeric entity using the Unicode code point in decimal, and &#xA9; is the same in hexadecimal. Numeric entities work for any character, even those without a name.

When should I encode non-ASCII characters?

If your page or email is not served as UTF-8, characters like é may display wrongly. Encoding them as numeric entities makes the text pure ASCII and safe in any setting. In modern UTF-8 pages it is usually unnecessary.

Can decoding be dangerous?

Decoding only converts text, but if you then insert the result into a page without escaping it again, decoded characters like < can become live HTML. Decode for viewing or editing, and encode again before publishing.

Does it handle double encoding?

It decodes one level at a time, which is the correct behaviour. &amp;lt; becomes &lt; after one decode, and you can run it again to get <. This helps you spot text that has been encoded twice by mistake.

Related tools