Skip to content

HTML entity encoder and decoder

Escape text so it shows up literally in a web page instead of being read as HTML, or turn entities like & and © back into normal characters.

  • Free, no limits
  • No sign-up
Everything happens in your browser; your data is never uploaded.
  • ✓ Free
  • ✓ No sign-up
  • ✓ Nothing uploaded

Next step

What to do next

How to use it

  1. Choose Encode or Decode.
  2. For encoding, choose how much to encode.
  3. Paste your text or HTML.
  4. Copy the result.
Try it now

Why HTML needs encoding

In HTML, some characters have special meaning. < starts a tag, & starts an entity, and quotes end attribute values. If you want those characters to appear as text, for example to show a code sample in a blog post, they must be written as entities:

CharacterEntity
<&lt;
>&gt;
&&amp;
"&quot;
'&#39;

So <p class="title">Tom & Jerry</p> encoded becomes &lt;p class=&quot;title&quot;&gt;Tom &amp; Jerry&lt;/p&gt;, which a browser displays exactly as typed instead of rendering a paragraph.

Encoding levels

  • Only the required ones (< > & " '): the right choice for showing code on a page or putting text into HTML attributes. Your page is UTF-8, so accented letters and symbols can stay as they are.
  • Also accented letters and special symbols: converts every non-ASCII character to a named entity like &copy;, &mdash; or &euro; where one exists, or a numeric entity like &#233; for é. Useful for old systems, email templates or files that are not UTF-8.
  • Every non-alphanumeric character: encodes all punctuation too. Rarely needed, but handy for obscuring text in some templating situations.

Decoding understands named entities, decimal entities (&#169;) and hex entities (&#xA9;).

HTML encoding and security (XSS)

Encoding is the main defense against cross-site scripting (XSS). If a site inserts user input into a page without encoding it, an attacker can submit <script>…</script> and the browser will run it for every visitor.

Rules of thumb:

  • Encode user input when it is output into HTML, not when it is stored.
  • Use your framework's built-in escaping: React, Vue, Angular, Django, Rails and Laravel templates encode by default. Be careful with "raw HTML" escape hatches like dangerouslySetInnerHTML or v-html.
  • HTML encoding is not enough for every context. Values inside <script>, inline event handlers, CSS or URLs need context-specific escaping. For URLs, use the URL encoder.

This tool is for one-off conversions; production code should rely on a tested library.

Common named entities

EntityCharacterName
&nbsp;(non-breaking space)keeps two words on one line
&copy; &reg; &trade;© ® ™copyright, registered, trademark
&ndash; &mdash;– —en dash, em dash
&hellip;…ellipsis
&times;×multiplication sign
&deg;°degree
&euro;€euro

Typing the characters directly is fine in UTF-8 pages; entities are mainly useful when you cannot be sure of the encoding. To look up any character's code, use the Unicode character tool.

Decoding text from emails and feeds

You often meet encoded text where it was not meant to be seen: product titles in an RSS feed showing &amp;amp;, CSV exports full of &quot;, or email subjects with &#8217; instead of an apostrophe. Paste such text in Decode mode to get clean characters back.

If the text was encoded twice, for example &amp;lt;, decode it twice. And if instead of entities you see garbled sequences like é or ’, that is a character encoding problem, not HTML encoding: use the text encoding fixer.

Frequently asked questions

How do I show HTML code as text on a web page?

Encode it with Only the required ones. The < > & and quote characters become entities, and the browser displays the code instead of rendering it.

What is the difference between &nbsp; and a normal space?

A non-breaking space prevents a line break at that point and is not collapsed with neighboring spaces.

Do I need to encode accented letters?

Not on a UTF-8 page, which is nearly every modern site. Encode them only for systems that do not handle UTF-8.

Does HTML encoding prevent XSS?

It is the main defense when inserting text into HTML, but other contexts like URLs and scripts need their own escaping.

Is my text uploaded?

No. Encoding and decoding happen in your browser.

Last updated: November 12, 2026

Recommended

Similar tools

If HTML entity encoder helped, you may need these too.

See all in category →

People also use