Skip to content
Utiloom

HTML Entity Encoder Decoder

Encode text for an explicit HTML text or quoted-attribute context, or decode HTML5 named and numeric references with bounded strict or lenient passes.

LocalNo retention

Reviewed July 13, 2026

Guide, examples, and validation Show

About this tool

Transform HTML character references without rendering decoded markup, while keeping document context, Unicode policy, parse recovery, and injection limits explicit.

HTML Entity Encoder and Decoder is useful when text needs to move safely between readable characters and escaped HTML entities. It helps with templating, CMS content, snippets, and debugging cases where symbols render incorrectly or need safe encoding.

  • Uses he 1.2.0 for HTML5 named and numeric references, astral Unicode code points, and strict parse errors.
  • Separates text-node, double-quoted attribute, single-quoted attribute, and conservative six-character encoding contexts with named, decimal, or hexadecimal output.
  • Supports optional ASCII-only encoding and one to five explicit decode passes with stale-result protection and TXT export.

How to use HTML Entities

Paste the input, choose whether you need encoding or decoding, and review the transformed text before copying it into the target HTML or content workflow. When special symbols matter, test the real final string so you can confirm the result matches the rendering context you care about.

When this tool is useful

  • Uses he 1.2.0 for HTML5 named and numeric references, astral Unicode code points, and strict parse errors.
  • Separates text-node, double-quoted attribute, single-quoted attribute, and conservative six-character encoding contexts with named, decimal, or hexadecimal output.
  • Supports optional ASCII-only encoding and one to five explicit decode passes with stale-result protection and TXT export.

Examples you can test

Load an example, compare the result with the expected output, then replace it with your own input.

Encode unsafe HTML characters

Example input

<span>Tom & Jerry</span>

Expected output

&lt;span&gt;Tom &amp; Jerry&lt;/span&gt;

Encoding is useful when showing markup as text instead of letting the browser parse it.

Decode copied entity text

Example input

Utiloom &amp; tools

Expected output

Utiloom & tools

Decoding helps review text copied from HTML source, CMS fields, or feeds.

Validation checklist

  • Encode text before displaying literal markup inside HTML.
  • Do not decode untrusted input and insert it as HTML without sanitization.
  • Check quotes and ampersands when output will be used inside attributes.

Frequently asked questions

Does this escape the most common HTML characters?

Yes, according to the selected context. Text mode escapes ampersand and angle brackets; quoted-attribute modes also escape the active quote; conservative mode escapes ampersand, angle brackets, both quotes, apostrophe, and backtick.

Can I decode entity strings copied from HTML source?

Yes. Paste the encoded text and the tool will decode it back into readable characters.

Does the encoder handle characters outside the Basic Multilingual Plane, such as emoji?

Yes. Enable ASCII-only output to encode non-ASCII code points. Named mode uses a named reference when available and a hexadecimal numeric reference as fallback, including the full code point for emoji.

Should I use named entities like &amp; or numeric entities like &#38;?

Named references are readable in HTML source. Decimal and hexadecimal numeric references are deterministic for every selected character. The chosen style does not change the decoded text when the output passes strict round-trip verification.

Can I paste an entire HTML document for decoding, or only fragments?

You can paste full documents or fragments. Only character references are decoded and all tags remain plain text in this tool. Decoded untrusted text must not be inserted into innerHTML or another HTML sink without an appropriate sanitizer.

What is the difference between strict and lenient decoding?

Strict mode rejects missing semicolons, invalid references, forbidden code points, and out-of-range numeric values. Lenient mode applies HTML parser-style recovery. Multiple passes are bounded to five for intentionally double-encoded input.

Related tools

Keep the workflow moving

Continue with tools that handle a related input, output, or validation step.

Developer

CSS Formatter

Format CSS, SCSS, or Less with stable output verification.

Local
Developer

cURL to Fetch & Axios Converter

Convert curl commands to fetch or axios code locally.

Local
Developer

HTML Formatter

Format HTML with explicit whitespace and embedded-code policies.

Local
Developer

HTML to Markdown Converter

Convert HTML body content into safe, policy-driven Markdown.

Local