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β
- Paste HTML / text β Any text containing entities.
- Scan β Regex matches &name; (named), &#NNN; (decimal), &#xHHHH; (hex). Each match decoded.
- Count β Frequency table per unique entity. Top entities highlighted.
- 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 (& means & got escaped twice).
Frequently asked questionsβ
Doubly-encoded entities?
When & appears, it means a sanitiser ran twice. Tool flags suspicious patterns like " (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 (&) 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-entity-counter β no signup, no upload, no data leaves your device.
Last updated: 2026-05-06 Β· Author: Ahsan Mahmood Β· Edit this page on GitHub