HTML Entity Encoder & Decoder

Developer Tools

Convert special characters to HTML entities and back, as named or numeric references.

Options
Text
With entities

Processed in your browser. A copy of each run is saved to your past runs so you can reopen it. Privacy

About

What the HTML Entity Encoder & Decoder does

The HTML Entity Encoder & Decoder escapes text so it can sit safely inside HTML, and turns entities back into characters. By default it escapes only the five characters that matter in markup; it can also encode every non-ASCII character. Entities can be named (é), decimal (é) or hex (é). Decoding understands every named entity in the HTML standard and never renders the HTML.

Steps

How to use it

  1. 1Choose Encode or Decode.
  2. 2Paste the text or the HTML; the result updates as you type.
  3. 3Copy the result, or press Swap to convert it back.

Example

A real run

Input

if (price < 10 && stock > 0) { label = “Deal”; }

Output

if (price &lt; 10 &amp;&amp; stock &gt; 0) { label = “Deal”; }

With non-ASCII too (named):
if (price &lt; 10 &amp;&amp; stock &gt; 0) { label = &ldquo;Deal&rdquo;; }

With the default setting only <, > and the two ampersands are escaped; the curly quotes are valid in UTF-8 and stay. Encoding non-ASCII as well turns them into &ldquo; and &rdquo;.

Options

Every setting, and when to use it

Encode only < > & " ' or all non-ASCII
Escaping the five markup characters is all modern UTF-8 pages need. Encoding every non-ASCII character as well suits old systems, email templates and ASCII-only feeds.
Named, decimal or hex
Named entities such as &copy; and &eacute; are the most readable. Numeric entities (&#169;, &#xA9;) work for every character, including ones without a name, and in XML, which only knows five named entities.

Good to know

Common problems and limits

Up to 5 MB. Decoding uses the HTML standard's entity table, so the input is never inserted into this page as HTML.

Encoding escapes characters; it does not sanitize HTML. To clean untrusted HTML that must stay HTML, use a sanitizer such as DOMPurify.

For URLs use the URL Encoder; for JavaScript and JSON strings use JSON Escape.

Audience

Who uses it

  • Developers and technical writersShow code samples containing < and & in blog posts, docs and CMS fields without them being read as tags.
  • Email developersEncode curly quotes, accents and symbols as entities for templates that must survive old email clients.
  • Content editorsDecode text full of &amp;, &#8217; and &nbsp; scraped from a web page or a feed back into readable characters.

FAQ

Frequently asked

What do &amp;, &nbsp; and &#8226; mean?

&amp; is an ampersand (&), &nbsp; a non-breaking space, and &#8226; a bullet (•), written as its decimal code point. Every entity starts with & and ends with ; and stands for a single character.

When must I escape characters in HTML?

Always escape < and & in text, because they start tags and entities. Inside an attribute value, also escape the quote character that wraps the value. Other characters, including accents and emoji, can be written directly in a UTF-8 page.

What is the difference between escaping and encoding?

Escaping replaces characters that have a special meaning in a format, such as < in HTML, so they are read as text. Encoding usually means changing the whole representation for transport, such as percent-encoding or Base64. HTML entities are an escaping mechanism.

Does escaping HTML prevent XSS?

Escaping user input when you put it into HTML text or quoted attributes is the core defense against cross-site scripting. It must match the context: JavaScript strings, URLs and CSS each need their own escaping, which is why frameworks escape output automatically.

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

The text was escaped twice: & became &amp;, then the & of that became &amp; again. Decode it twice, or fix the step that escapes already-escaped text.

Is my text sent anywhere?

No. Encoding and decoding happen in your browser. A copy of each run is saved to your past runs so you can reopen it.

Automation: an MCP tool html_encode(text, options), html_decode(text) and an n8n node are planned for this tool.

GuideEncoding vs hashing vs encryption, with examples →Encoding changes the format, hashing makes a fingerprint, encryption hides data behind a key. Worked examples with Base64, SHA-256, HMAC, TOTP and UUIDs.
Built and maintained by Radhika SinghLast updated Questions: hello@operativez.ai