HTML Entity Encoder / Decoder

Escape text so it displays safely inside HTML, or decode HTML entities like & and © back into normal characters.

🔒 Runs in your browser — your text is never uploaded.Shortcuts: / search · Ctrl/⌘ + Enter main button

How to use the HTML Encoder/Decoder

  1. Choose Encode or Decode.
  2. Paste your text or HTML.
  3. Optionally encode all non-ASCII characters as numeric entities.
  4. Copy the result.

Example

Input
<p>Fish & Chips</p>
Result
&lt;p&gt;Fish &amp; Chips&lt;/p&gt;

What HTML encoding does

Some characters have a special meaning in HTML. A “<” starts a tag and an “&” starts an entity. To show them as plain text on a page, you replace them with entities such as &lt; and &amp;. Decoding turns entities back into the characters they stand for.

What gets encoded

  • Always: “&” becomes &amp;, “<” becomes &lt; and “>” becomes &gt;.
  • Encode quotes (on by default): double quotes become &quot; and single quotes become &#39;. This matters when the text goes inside an HTML attribute.
  • Encode all non-ASCII as numeric entities: turns every character outside basic ASCII, such as “é”, “€” or emoji, into a numeric entity like &#233;. Use it when your file or system cannot handle UTF-8.

Decoding

Decode understands named entities such as &copy; and &mdash;, decimal entities such as &#169; and hexadecimal ones such as &#x2713;. Text that is not an entity is left untouched.

When to use it

  • Showing code samples or HTML tags on a web page without the browser treating them as markup.
  • Putting user-supplied text safely inside HTML. Escaping output is one important part of preventing cross-site scripting, though your application should do it automatically too.
  • Cleaning up text that was copied with visible entities such as &amp;amp;.
  • Preparing text for XML or email templates.

Related tools

To strip tags and keep only the readable text, use the HTML to Text Converter. To turn Markdown into HTML, use the Markdown to HTML.

Frequently asked questions

Which characters must be encoded in HTML?

At minimum &, < and > in text, plus " and ' inside attribute values. Encoding them prevents the browser from treating your text as code.

Does decoding run any HTML?

No. Only entities are converted to characters. Tags in your input are left as plain text.

Why do I see &amp;amp; in my text?

The text was encoded twice. Run Decode once to turn &amp;amp; back into &amp;, and a second time to get a plain “&”.

Do I need to encode accented letters?

Usually not. Modern pages use UTF-8, so “é” can be written as is. Use the numeric-entity option only for systems that cannot handle UTF-8.

Learn more

More tools you may like