HTML Entity Encoder / Decoder

Escape special characters so text or code displays correctly inside an HTML page instead of being treated as markup — or turn a string full of &, " and ’ back into readable text.

Runs entirely in your browser. Nothing you enter is uploaded or stored.

How to use it

  1. Choose Encode to make text safe for HTML, or Decode to convert entities back to characters.
  2. Paste your text. The result updates as you type.
  3. When encoding, the recommended setting escapes only the five characters that have special meaning in HTML. Choose “non-ASCII” if the page or email system can't handle UTF-8 characters, or “every character” to obfuscate a string (for example an email address) from very simple scrapers.

Which characters need escaping

CharacterEntityWhy
&&Starts every entity, so a literal ampersand must be escaped first
<&lt;Starts a tag
>&gt;Ends a tag (escaped for symmetry and safety)
"&quot;Ends a double-quoted attribute value
'&#39;Ends a single-quoted attribute value

Escaping these five is what prevents user-supplied text from being interpreted as HTML — the core defense against cross-site scripting (XSS) when inserting text into HTML. In your own code, let your template engine or framework do it automatically rather than escaping by hand; this tool is for one-off snippets, blog posts that show code, and debugging.

Decoding entities

Decoding understands all named entities defined by HTML (&copy;, &mdash;, &nbsp;, &eacute;…), decimal entities (&#8217;) and hexadecimal entities (&#x2019;). It's handy when text from a database, RSS feed, API or CMS export shows up full of codes — a common sign that it was escaped twice. If you still see entities after decoding, click Swap and decode again.

Decoding is done safely: the text is parsed as plain text, never as live HTML, so pasting a snippet that contains scripts doesn't run them.

Frequently asked questions

What is an HTML entity?

A code that represents a character in HTML, starting with & and ending with a semicolon — either a name like &copy; or a number like &#169;. Browsers display the character instead of the code.

Do I need to encode accented letters like é?

Not if your page is served as UTF-8, which is the default for modern websites (meta charset="utf-8"). Encoding them is only needed for systems that can’t handle UTF-8.

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

&nbsp; is a non-breaking space: it looks like a space but prevents a line break at that point, and multiple non-breaking spaces aren’t collapsed into one like normal spaces.

Is my text uploaded?

No. Encoding and decoding happen in your browser.