Skip to main content

HTML Entity Counter

HTML entities are escape sequences for special characters: & for &, < for <, > for >, " for ", ☃ for ☃. Counting entities is useful for HTML migration audits ("did we escape everything?"), email-template inspection, and security review (are <script> tags being properly entity-escaped?). The ZTools HTML Entity Counter parses any text, lists every named and numeric entity it finds with frequency, and shows the resolved character for each.

Use cases​

Audit a template for escape consistency​

A template uses & in some places and & in others. Counter highlights the mismatch.

Check user-generated content for unescaped special chars​

After a sanitiser runs, count entities. Too few = sanitiser missed cases. Too many = over-escaping.

Migrate from HTML to Markdown​

Markdown rarely needs entities. Counter shows what to convert back to plain chars.

Decode hex / decimal numeric entities​

☃ → ☃ (snowman). Counter shows the resolved char alongside the count.

How it works​

  1. Paste HTML / text — Any text containing entities.
  2. Scan — Regex matches &name; (named), &#NNN; (decimal), &#xHHHH; (hex). Each match decoded.
  3. Count — Frequency table per unique entity. Top entities highlighted.
  4. Display — Table: entity, decoded char, count. Plus total entity count and total chars.

Examples​

Input: "This & that <tag>"

Output: Entities: & (1, decodes to &), < (1, <), > (1, >). Total: 3.


Input: Mixed: "© 2026 — ☃"

Output: © → ©, — → —, ☃ → ☃. 3 entities.


Input: Entity-stuffed text

Output: Counter helps spot if entities are being doubly-encoded (&amp; means & got escaped twice).

Frequently asked questions​

Doubly-encoded entities?

When &amp; appears, it means a sanitiser ran twice. Tool flags suspicious patterns like &quot; (escape of ").

Numeric vs named entities?

Named (©, —) more readable; numeric (©, —) more universal. Tool decodes both.

Maximum text size?

Several MB works fine. The regex scan is O(n).

Privacy?

All in browser.

Tips​

  • For HTML output, use named entities for readability — © beats ©.
  • For email HTML, more conservative — use entities for any non-ASCII char to avoid encoding mismatches.
  • For Markdown migration, decode all entities first — Markdown handles plain chars natively.
  • Doubly-encoded entities (&amp;) are a security smell — investigate the sanitisation pipeline.

Try it now​

The full HTML Entity Counter runs in your browser at https://ztools.zaions.com/html-entities — no signup, no upload, no data leaves your device.

Open the tool ↗


Last updated: 2026-05-06 · Author: Ahsan Mahmood · Edit this page on GitHub