CRAFTAI.IN

Text utilities · Practical explanation

Count digits in text: characters versus whole numbers

A digit counter doesn't count how many numbers appear in a sentence. It counts individual decimal-digit characters. That distinction matters when checking invoice references, application forms, exported text and logs.

Published 15 November 2026 · CraftAI editorial team · Examples reproducible using the linked local tool

Open CraftAI digit counter →

A digit is not the same thing as a number

Consider Invoice 007 sent 2026-11-15. The reference 007 has three digit characters. The date has four digits in the year, two in the month and two in the day. Altogether, that is 11 digit characters, but only four contiguous groups of digits: 007, 2026, 11 and 15. The hyphens and spaces are separators; the counter doesn't interpret or validate the date.

Copyable test input

Invoice 007 sent 2026-11-15

Expected output in Count text digits: {"digitCount":11}. Count it manually: 3 + 4 + 2 + 2 = 11.

How the CraftAI digit counter works

  1. Open Count text digits.
  2. Paste a short sample or open an ordinary text file, staying within the tool's published input-size limit.
  3. Choose Count text digits. The output reports digitCount.
  4. Change one digit to a letter and run again: the total should decrease by one. Change a hyphen to another symbol and the count should stay the same.
  5. If you need the numerical values themselves rather than a digit total, use a separate numeric-value parser (this digit counter does not extract whole numbers).

What about non-English digit characters?

The released counter uses the Unicode Decimal_Number character category (\p{Nd}). This includes ordinary ASCII 0–9 as well as decimal-digit characters used by other writing systems. It doesn't automatically count every character that people might describe as numeric (such as some Roman numeral symbols), because those belong to other Unicode categories.

Unicode example

Text: Room 12B and A7. The first two digits are fullwidth forms of 1 and 2; the final 7 is ASCII. The Unicode decimal-digit total is 3, while a simple ASCII-only [0-9] matcher would count 1.

Do not assume all downstream software treats these characters interchangeably. Payment forms, barcode encoders and identifiers often require ASCII digits specifically.

Which tool is right for your task?

You want to…Use…
Count decimal-digit charactersDigit counter
Extract whole numeric valuesA dedicated numeric-value extraction tool (not currently offered here)
Count all characters and spacesCharacter counter
Check a valid UPC-A codeUPC-A checksum walkthrough

Common counting traps

Leading zeros

The string 00042 contains five digit characters. Turning it into a numeric value first would remove three zeros, changing the result. Preserve the original text when counting reference numbers, postal codes and product identifiers.

Minus signs and decimal points

-12.50 contains four digits: 1, 2, 5 and 0. Neither the minus sign nor the decimal point is a decimal-digit character. The counter cannot tell you how many negative numbers or decimal values are present.

Phone numbers and dates

Phone numbers, invoice IDs and dates contribute digit characters just like prices do. If your task is to check a specific data field, isolate that field first instead of pasting the entire document.

Image-only documents

A digit counter takes text, not photographs or image-only PDFs. You need a trustworthy text extraction or OCR step before counting, and recognition mistakes may change the result. Don't interpret a count as document validation.

How to verify an unexpected result

Start with a ten-character hand-written test where you know the answer. Add one digit at a time. Next test zeros, punctuation and fullwidth digits. If the result differs, contact CraftAI support with the short nonsensitive sample and expected total. Avoid sharing account numbers, patient records, passwords or other confidential material in support messages.

Count digits in your text →

Continue with a working CraftAI tool

Use the relevant browser-based utility, check its instructions and verify the result before relying on it. Report incorrect outputs with a reproducible example; don't include confidential inputs in reports.

More practical guides · How we test tools · Report a problem

Built on Hatchable