Digit frequency counter
In 100234001 the digit zero appears 4 times, one appears 2 times and two, three and four once each. Enter any non-negative whole number and get all ten digit counts in fixed order. Free in your browser.
- Free
- Runs in your browser
- No sign-up
- Your data stays on your device
Run — free
A digit frequency histogram shows how many times each decimal digit occurs in a non-negative integer. Instead of scanning a long identifier or test value by eye, enter n and receive ten counts in fixed order from digit zero through digit nine. The result is compact, deterministic, and ready for code, spreadsheets, lessons, or number-pattern experiments.
How the decimal digit histogram is calculated
The counter creates ten bins, one for each decimal digit from zero through nine, and initializes every bin to zero. It then examines the integer one digit at a time. Dividing by ten leaves a remainder that identifies the rightmost digit; the matching bin is increased, the rightmost digit is removed with integer division, and the process repeats until no digits remain.
For 100234001, for example, zero occurs four times, one occurs two times, and digits two, three, and four occur once each. All other bins remain zero. The returned histogram always has exactly ten positions, so index zero is the count of digit 0, index one is the count of digit 1, and so on through index nine.
This fixed shape is easier to compare and aggregate than an object that omits unused digits. The value zero is a special but important case: its decimal notation contains one zero digit, so its histogram begins with one rather than containing ten zero counts. No sign, separator, or formatting character is counted as a digit.
Input rules and the response contract
Provide n as a non-negative safe integer. Leading plus signs and leading zeroes in a string do not create extra digits because the input represents an integer, not a piece of text; after numeric normalization, 0007 is the number 7 and therefore has one counted digit. Fractions, exponent-form strings, commas, spaces between digits, words, empty fields, and values beyond JavaScript's exact safe-integer range are also rejected.
On success, the response is an object with a histogram array of ten non-negative integers. Adding those ten counts gives the number of decimal digits in normalized n. The position of each count never changes, including when a digit does not occur.
That predictable contract makes the output straightforward to consume without sorting keys, filling missing values, or guessing whether zero-count digits were intentionally omitted.
Using frequency counts in learning and software
Digit-frequency tables are useful wherever the distribution of decimal symbols matters. Teachers can prepare exercises about place notation, frequency tables, and basic descriptive counting, then show learners a complete answer that includes absent digits as zeroes. Recreational number theory experiments can group integers by repeated digits, search for values with balanced decimal composition, or inspect patterns in generated sequences.
The result may also serve as a small numeric feature for explicitly non-security-sensitive analysis. It is not a checksum, proof of identity, or protection against tampering: many different integers share the same histogram because digit order is deliberately discarded. The implementation is pure, bounded, and deterministic, with no network request, random source, stored state, or clock.
Quick interactive use is free in the browser.
What you can do with it
Teach frequency tables
Turn an integer into ten explicit counts for lessons about decimal digits, tallying, and histograms.
Explore decimal patterns
Compare repeated-digit distributions across identifiers, sequences, or recreational number theory experiments.
FAQ
What does each histogram position mean?
Index 0 counts zeroes, index 1 counts ones, and the pattern continues through index 9, which counts nines.
How is the number zero counted?
Zero is a one-digit integer, so its histogram has a count of 1 at index 0 and 0 at every other index.
Are digits with no occurrences included?
Yes. The array always contains ten counts, and a digit that does not occur has a count of zero.
Do leading zeroes count?
No. The input is an integer, so leading zeroes are removed during numeric normalization and are not part of its decimal representation.
Can I count the words in a text with this tool?
No. This tool counts only the decimal digits inside one whole number, from zero to nine. Counting how often words appear in a piece of writing is a different task with its own counter.
Related tools
For developers — API access
Everything on this page is available programmatically. This section is for teams who want to wire it into their own systems; everyone else can just use the tool above.
API endpoint
Prefer to automate it? One authenticated POST creates the task; the result comes back by webhook or a signed link. The same capability also runs here on the web, by email and from Telegram — and soon from our app too.
Call it from your stack
curl -X POST https://api.kit.forhosting.com/numth/digit-frequency \
-H "Authorization: Bearer $KIT_KEY" \
-H "Content-Type: application/json" \
-d '{"n":100234001}'const res = await fetch("https://api.kit.forhosting.com/numth/digit-frequency", {
method: "POST",
headers: {
"Authorization": `Bearer ${process.env.KIT_KEY}`,
"Content-Type": "application/json"
},
body: JSON.stringify({
"n": 100234001
})
});
const { task_id } = await res.json();import os, requests
res = requests.post(
"https://api.kit.forhosting.com/numth/digit-frequency",
headers={"Authorization": f"Bearer {os.environ['KIT_KEY']}"},
json={
"n": 100234001
},
)
task_id = res.json()["task_id"]<?php
$res = file_get_contents("https://api.kit.forhosting.com/numth/digit-frequency", false, stream_context_create([
"http" => [
"method" => "POST",
"header" => "Authorization: Bearer " . getenv("KIT_KEY") . "\r\nContent-Type: application/json",
"content" => '{"n":100234001}',
],
]));
$task = json_decode($res, true);body := bytes.NewBufferString(`{"n":100234001}`)
req, _ := http.NewRequest("POST", "https://api.kit.forhosting.com/numth/digit-frequency", body)
req.Header.Set("Authorization", "Bearer "+os.Getenv("KIT_KEY"))
req.Header.Set("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)Example request
{
"n": 100234001
}Example response
{
"task_id": "tsk_a1b2c3d4e5f6a1b2c3d4e5f6",
"type": "numth.digit_frequency",
"status": "queued",
"_links": {
"result": "/tasks/tsk_…/result"
}
}The API is asynchronous: the call returns a task_id immediately and the result arrives by webhook. Polling is capped at 1 req/s per task.
Pricing
Published price — no tokens, no invented credits. A failed task is never charged.
Errors
| HTTP | Code | Meaning |
|---|---|---|
401 | unauthorized | Missing or invalid API key. |
402 | insufficient_balance | Your balance doesn't cover the task price. |
404 | unknown_type | That task type doesn't exist. |
429 | rate_limited | Too many requests. Use the webhook instead of polling. |
Technical notes
Zero is handled as a real one-digit number, negative values are rejected, and the same pure calculation runs in the browser and through the API without network-dependent behavior.
Input rules and the response contract
A JSON integer is the ordinary API form, while a plain string of ASCII decimal digits is also understood by the shared calculation used by the text-oriented browser client. Negative integers produce invalid_input as required, rather than silently dropping the minus sign.
Using frequency counts in learning and software
Automated API calls use the published base price of $0.002 per successful item, while malformed and negative inputs fail before producing a result.
Integration use cases
Build digit-loop fixtures
Create deterministic expected values for software that extracts and counts the digits of an integer.
Technical questions
Can I enter a negative integer?
No. Negative values are rejected with invalid_input rather than counting the digits of their absolute value.
What does an API request cost?
The browser counter is free. Each successful API request uses the published base price of $0.002.