Digital root in base
In base 16, 255 is written FF, its digits add up to 30 and then to 15: the digital root is 15, reached in 2 steps. Choose any base of at least 2 and see the root, the steps and each sum. Free in your browser.
- Free
- Runs in your browser
- No sign-up
- Your data stays on your device
Run — free
Worked example
- N
- 255
- Base
- 16
- Digital root
- 15
- Additive persistence
- 2
The digital root of a non-negative integer in an arbitrary base is the single digit you obtain by repeatedly replacing the number with the sum of its digits written in that base until the result is strictly smaller than the radix. In base ten this recovers the familiar digital root used in divisibility rules; in base two it is the eventual parity of the popcount process; in hexadecimal and other radices the same idea appears in checksums, contest problems, and modular arithmetic teaching. This calculator accepts a non-negative integer n and an integer base b at least two, runs a deterministic iterative digit-sum algorithm, cross-checks the closed form modulo b minus one, and returns the digital root, the additive persistence, and every intermediate step so you can verify the path by hand.
What a base-b digital root means
Fix an integer radix b greater than or equal to two and a non-negative integer n. Write n in base b and add its digits; the sum is a smaller non-negative integer whenever n is at least b. Repeat until the value lies in the single-digit range zero through b minus one.
That final value is the digital root of n in base b. The number of full digit-sum steps is the additive persistence for that radix. For example, two hundred fifty-five in base sixteen is F F, the digit sum is thirty, which is one E in hex, and the next sum is fifteen, already a single hex digit; the digital root is fifteen and the persistence is two.
In base ten the same process on nine thousand eight hundred seventy-five yields two with persistence three, matching the classical decimal digital root. A deep reason the process is stable is modular arithmetic: for positive n the base-b digital root equals n modulo b minus one, except that multiples of b minus one map to b minus one rather than zero, while zero maps to zero.
That congruence generalizes the familiar base-ten link between digit sums and residues modulo nine, and it is why checksums and divisibility heuristics still make sense when you change the radix. Additive persistence remains a separate complexity measure: how many iterations the digit-sum map needs before it stabilizes in the chosen base.
How this calculator evaluates the repeated base-b digit sum
Call the capability with fields n and base. The integer n must be non-negative; the integer base must be at least two. While the current value is greater than or equal to the base, the engine extracts base-b digits by successive division, sums them, records a step with the previous value and the new digit sum, and continues from that sum.
When a single digit in zero through base minus one remains, that digit is the digital root and the step count is the additive persistence. Independently, a closed form computed as one plus n minus one modulo base minus one (with the usual zero and multiple conventions) confirms the same root, so a mismatch would surface as an internal consistency error rather than a silent wrong answer.
Practical use, limits, pricing, and delivery
Use the browser tool when you want an immediate digital root in base b while studying modular arithmetic, checking a programming-contest sample, or explaining why digit sums relate to residues modulo b minus one without installing a computer-algebra system. Accepted inputs are non-negative integers for n within the safe integer range and integer bases of two or more. Results are fully deterministic: the same n and base always yield the same digital root, the same additive persistence, and the same ordered list of intermediate steps.
There is no language model, no external arithmetic service, and no randomness, so the capability is safe to pin in automated tests and reproducible notebooks.
What you can do with it
Contest and homework verification in any radix
Students and graders can confirm digital roots and additive persistence for arbitrary non-negative n and base b >= 2, inspecting every intermediate base-b digit sum without a local CAS.
Modular arithmetic and checksum teaching
Lesson materials that introduce congruence modulo b minus one can show the base-b digital root beside the iterative path so learners connect digit sums to residues in any radix.
FAQ
What happens if the base is below two?
Digit systems require base >= 2; bases below two are rejected and not charged.
How is this different from the decimal digital root calculator?
The decimal-only digital root tool always uses base ten. This capability takes an explicit base so you can compute digital roots in binary, hexadecimal, or any other integer radix of two or more.
Is the digital root in base calculator free?
The browser tool runs free on your device.
Does the base-b digital root always match n modulo (b-1)?
For positive n the digital root equals n mod (b-1), except multiples of (b-1) map to (b-1) instead of zero. Zero maps to zero. This calculator also returns the iterative steps so you can verify by hand.
What is the digital root of 255 in base 16?
It is 15, the hexadecimal digit F. In base 16, 255 is FF, whose digits add up to 30; 30 is written 1E, and its digits add up to 15, a single digit. That took 2 steps.
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/digital-root-base \
-H "Authorization: Bearer $KIT_KEY" \
-H "Content-Type: application/json" \
-d '{"n":255,"base":16}'const res = await fetch("https://api.kit.forhosting.com/numth/digital-root-base", {
method: "POST",
headers: {
"Authorization": `Bearer ${process.env.KIT_KEY}`,
"Content-Type": "application/json"
},
body: JSON.stringify({
"n": 255,
"base": 16
})
});
const { task_id } = await res.json();import os, requests
res = requests.post(
"https://api.kit.forhosting.com/numth/digital-root-base",
headers={"Authorization": f"Bearer {os.environ['KIT_KEY']}"},
json={
"n": 255,
"base": 16
},
)
task_id = res.json()["task_id"]<?php
$res = file_get_contents("https://api.kit.forhosting.com/numth/digital-root-base", false, stream_context_create([
"http" => [
"method" => "POST",
"header" => "Authorization: Bearer " . getenv("KIT_KEY") . "\r\nContent-Type: application/json",
"content" => '{"n":255,"base":16}',
],
]));
$task = json_decode($res, true);body := bytes.NewBufferString(`{"n":255,"base":16}`)
req, _ := http.NewRequest("POST", "https://api.kit.forhosting.com/numth/digital-root-base", 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": 255,
"base": 16
}Example response
{
"task_id": "tsk_a1b2c3d4e5f6a1b2c3d4e5f6",
"type": "numth.digital_root_base",
"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
How this calculator evaluates the repeated base-b digit sum
The short alias b is accepted for base. The implementation validates that both fields are present, finite, and integral, then rejects negatives for n and any base below two with invalid_input. Missing fields, non-integers, negative n, and bases below two fail with invalid_input and are not charged.
Practical use, limits, pricing, and delivery
Each successful request is one billable item at $0.002; failed validation does not consume balance. Wire the endpoint into number-theory demos, radix-conversion tutorials, recreational math pages, or integer preprocessing steps where you already trust exact digit arithmetic more than approximate heuristics or opaque black-box calculators that only handle decimal digital roots.
Integration use cases
Automated number-theory pipelines
Scripts that classify integers by digital root in a chosen base or measure additive persistence can call a single deterministic item-priced endpoint instead of embedding ad hoc digit loops per radix.
Technical questions
How do I compute the digital root in a given base with this API?
Send a JSON body with non-negative integer n and integer base (or alias b) at least two to the numth.digital_root_base capability. The response returns digital_root, additive_persistence, and the ordered list of digit-sum steps.