HTML Entity Encoder and Decoder: Escape HTML

Use this html entity encoder decoder to escape special characters so they show safely in a web page. Paste text to turn <, >, & and quotes into entities, or paste entities like &amp;amp; to decode them back. It helps when you post code or fix broken text.

HTML Entity Encoder / Decoder

Escape and unescape HTML.

<&lt;
>&gt;
&&amp;
"&quot;
'&#39;
&nbsp;
©&copy;
®&reg;
™&trade;
€&euro;
—&mdash;
…&hellip;
Everything runs in your browser. Nothing you enter or upload is sent to a server.

How to use the HTML Entity Encoder / Decoder

  1. Paste text or HTML.
  2. Choose Encode or Decode.
  3. Pick how non-ASCII characters are written.
  4. Copy the output.

How it works

Encoding replaces the five HTML special characters (& < > " ') with entities so text displays literally instead of being read as code, which also prevents HTML injection. Decoding uses your browser’s own HTML parser, so every named and numeric entity is supported.

Example

<a href="x">Tom & Jerry ©</a> encodes to &lt;a href=&quot;x&quot;&gt;Tom &amp; Jerry &copy;&lt;/a&gt;.

Frequently asked questions

Why escape HTML?

So code samples display as text and user input cannot inject HTML.

Named or numeric entities?

Both work in all browsers; numeric codes cover every character.

Is &nbsp; a normal space?

No, it is a non-breaking space that keeps words together.

See also: URL Encode and Decode, Base64 Encode & Decode.

Encode or decode HTML entities

How to use it

  1. Paste your text.
  2. Choose encode or decode.
  3. Read the result.
  4. Copy it.

More questions

Why escape HTML?

So code shows as text instead of running in the page.

Does it encode emoji?

You can choose to encode all non-ASCII characters.

Is my text sent anywhere?

No. Everything stays in your browser on your device.

Related tools: URL Encode and Decode, HTML Formatter and Minifier, Base64 Encode & Decode.

Four steps to escape HTML: paste HTML, choose encode or decode, pick named, decimal or hex for non-ASCII characters, copy
How to encode and decode HTML entities.
HTML entity example: a link with an ampersand, apostrophe and copyright sign escaped with named, decimal and hex entities
Worked example from the tool code.