Encoding & Hashing

HTML Entity Encoder / Decoder

Encode and decode HTML entities, with optional encoding of all non-ASCII characters.

Privacy: This tool runs entirely in your browser. Your data never leaves your device and is never uploaded to any server.

Output will appear here.

How to use this HTML entity encoder

  • Paste the text or markup you want to encode.
  • Choose whether to encode every non-ASCII character or only the special ones.
  • Switch to decode to turn entities back into characters.
  • Encoding happens locally; nothing is uploaded.

Entities you will actually need

CharacterNamedNumericWhy it matters
&&&Every ampersand must be escaped, including inside URLs
<&lt;&#60;Otherwise the browser starts reading a tag
>&gt;&#62;Closes a tag, though it is usually safe in body text
"&quot;&#34;Ends a quoted attribute early
'&apos;&#39;The same problem inside a single-quoted attribute
space&nbsp;&#160;A space that will not wrap or collapse

What an HTML entity is

An entity is a short code that stands in for a character. &amp; represents an ampersand and &lt; represents a less-than sign.

Because < and > delimit tags, a browser cannot tell literal text from markup without help. Entities remove that ambiguity.

Named and numeric forms

Named entities such as &amp; and &copy; are readable but limited to a defined list.

Numeric entities such as &#169; work for any character at all, which is why they are the safe fallback for symbols without a name.

Encoding is also a security measure

If you display user-supplied text without escaping it, an attacker can close your markup and inject their own — the classic cross-site scripting bug.

Escaping, or letting a framework do it, is what stops a comment containing a script tag from becoming executable. Never treat it as optional.

The entities worth knowing by heart

  • &amp; — ampersand, the one people forget.
  • &lt; and &gt; — the angle brackets that delimit tags.
  • &quot; — a double quote inside an attribute.
  • &#39; or &apos; — an apostrophe inside an attribute.
  • &nbsp; — a non-breaking space that will not wrap.

Frequently asked questions

What are HTML entities?

HTML entities represent reserved characters such as <, > and &, or non-ASCII characters, as named or numeric codes.

Why encode HTML?

Encoding prevents browsers from interpreting text as markup, which is useful for displaying code snippets safely.

Is my text uploaded?

No. Encoding and decoding happen locally in your browser.

Should I use named or numeric entities?

Named entities are readable and fine for the common characters. Numeric ones work for anything at all, including symbols that have no name, so they are the safe fallback.

Does encoding change how the text looks?

No. The browser renders the entity as the character it represents, so an ampersand written as &amp; still displays as an ampersand.

Do I need to encode quote characters?

Only inside an attribute. In body text a quote is harmless, but inside a quoted attribute it would end the attribute early.

More Encoding & Hashing tools