HTML Entities to ASCII Converter

Decodes &#N; decimal, &#xHH; hexadecimal, and the six common named HTML entities (amp, lt, gt, quot, apos, nbsp) back into literal characters, then strictly validates the fully-decoded result is 7-bit ASCII, rejecting anything, including a lone  , that decodes outside the 0-127 range. A free online tool from Staaarter, right in your browser.

Runs locallyUpdated 2026-07-27

Overview

Introduction

HTML source and feeds are full of entities like H and & standing in for literal characters, and sometimes you need to confirm not just what they decode to, but that the result is strictly plain ASCII.

This tool decodes the common entity forms and then applies this category's strict 7-bit ASCII check to the result, catching cases where a decoded entity, even a completely valid one, produces a character outside that range.

What Is HTML Entities to ASCII Converter?

An HTML entity decoder that layers a strict-ASCII validation step on top of decoding, the read side of the ASCII to HTML Entities Converter pair for this category.

It recognizes decimal and hexadecimal numeric entities of any value plus six common named entities, matching the scope of this site's general HTML Entity Decoder, but adds the ASCII-only requirement on the output.

How HTML Entities to ASCII Converter Works

The input is scanned for entity patterns: &#digits;, &#xhexdigits;, and &name; forms. Numeric entities are converted directly via their code point; named entities are looked up in a small fixed table (amp, lt, gt, quot, apos, nbsp). Anything unrecognized is left as literal text.

The fully-decoded string is then validated character-by-character against the 0-127 ASCII range using this category's shared strict-ASCII validator; the first out-of-range character, however it originated, stops the process and is reported by position and code point.

When To Use HTML Entities to ASCII Converter

Use it when you have entity-encoded text and need to both decode it and confirm the result is strictly ASCII, for example validating a legacy protocol payload or config value that arrived HTML-entity-encoded.

If you just need permissive entity decoding without the ASCII requirement, use the general HTML Entity Decoder instead.

Features

Advantages

  • Catches decoded entities that produce non-ASCII characters, including the easy-to-miss   case, rather than silently accepting them.
  • Handles both numeric entity forms (decimal and hex) at any code point, plus the six most common named entities.
  • Leaves unrecognized entities visibly intact instead of guessing at their meaning.

Limitations

  • Only recognizes six named entities; anything outside that set (©, ♥, etc.) passes through as literal text unless written numerically.
  • Rejects any decoded result containing a character above 127, even entities like   that decode perfectly correctly to a real, well-defined character.

Examples

Decoding decimal and hex numeric entities

Input

Hi

Output

Hi

Both entities decode to characters within the 0-127 range, so validation passes and the literal text is returned.

Decoding named entities

Input

Tom & Jerry's <show>

Output

Tom & Jerry's <show>

The named entity &amp; and the numeric &#39;, plus the &lt;/&gt; pair, all decode to characters within the ASCII range.

Rejecting a decoded non-breaking space

Input

a&nbsp;b

Output

Decoded character is not valid ASCII: Character " " at position 2 has code point 160 (0xA0), which is outside the 7-bit ASCII range (0-127).

&nbsp; decodes correctly to U+00A0, but that character's code point (160) is above 127, so the strict ASCII check rejects it.

Best Practices & Notes

Best Practices

  • Treat a rejection naming a decoded character above 127 as information about the original entity, not a sign the entity syntax itself was wrong.
  • Pair with ASCII to HTML Entities Converter to confirm a round trip returns your exact original text.

Developer Notes

Entities are matched with a single regex (/&(#x[0-9a-fA-F]+|#\d+|[a-zA-Z]+);/g), numeric forms resolved via String.fromCodePoint after a finite/range check to avoid throwing on malformed values, named forms looked up in a six-entry table, and the fully-decoded string is then run through the category's shared validateStrictAscii helper.

HTML Entities to ASCII Converter Use Cases

  • Validating that an entity-encoded value decodes to strict ASCII before using it in a legacy or embedded system
  • Catching accidental inclusion of &nbsp; or other non-ASCII entities in text meant to be pure ASCII
  • Round-trip testing against ASCII to HTML Entities Converter's output

Common Mistakes

  • Assuming &nbsp; is "just a space" and being surprised it's rejected, it decodes to the distinct non-breaking space character U+00A0, not the ASCII space U+0020.
  • Expecting the full HTML5 named entity list to be supported; only six common named entities are recognized, matching this site's general HTML Entity Decoder.

Tips

  • If output still shows an entity like &foo; unchanged, that's an unrecognized name, not something the ASCII check touched.
  • A rejection naming code point 160 specifically almost always traces back to a decoded &nbsp;.

References

Frequently Asked Questions