Digit Sum Calculator

Digit sum, digital root and the 3 and 9 divisibility test for any number in bases 2–36.

  1. Enter valuesUse your own inputs or an example
  2. CalculateApply your selected settings
  3. View resultExplore the answer and explanation

Enter a number

Enter your values below to get started.

Examples:
Spaces and commas are ignored. Use A–Z for digits 10–35 in bases above 10.
2 = binary, 8 = octal, 10 = decimal, 16 = hexadecimal.
Find
Reset restores the default values.

Tips for this calculator

A number is divisible by 9 exactly when its digit sum is divisible by 9; the same rule works for 3.

The digital root equals 1 + (n − 1) mod 9 for any positive whole number n.

Paste huge numbers such as 2100 or 100! in full: the calculator reads digits as text, so nothing is rounded.

Pick Sum of 1 to N to total the digit sums of every number from 1 to N in one step.

A digit sum calculator adds the individual digits of a number, so 98,765 gives 9 + 8 + 7 + 6 + 5 = 35. Enter any whole number, a number with up to 100,000 digits, or a number in base 2 to 36 to get the digit sum, the digital root, the 3 and 9 divisibility test, a digit-by-digit table, or the total of all digit sums from 1 to N.

What is a Digit Sum?

A digit sum is the total you get by adding every digit of a number. The digit sum of 4,739 is 4 + 7 + 3 + 9 = 23, and the digit sum of 1,000,000 is 1.

n=∑i=0k−1di⋅10in = \sum_{i=0}^{k-1} d_i \cdot 10^{i}
S(n)=∑i=0k−1diS(n) = \sum_{i=0}^{k-1} d_i

Mathematicians write the digit sum as S(n) or s10(n), where di is the digit in position i and k is the number of digits. The German word for the digit sum is Quersumme. The digit sum depends on the base: 13 has a digit sum of 4 in base 10 but 3 in base 2, where 13 is written 1101.

Adding the digits again until one digit remains gives the digital root. For 4,739: 23 → 2 + 3 = 5, so the digital root is 5.

InteractiveAdd the digits one tile at a time

How Does the Digit Sum Calculator Work?

The digit sum calculator reads your number as text, converts each character to its digit value, adds the values and repeats the addition until one digit is left. Reading the number as text means a 31-digit value such as 2100 = 1,267,650,600,228,229,401,496,703,205,376 keeps every digit and returns the exact digit sum of 115.

InteractiveFrom a number to its digital root, round by round
  1. Clean the input

    Spaces, commas and underscores are removed; a minus sign or decimal point is noted and ignored.

  2. Check each digit

    Every character must be a valid digit in the chosen base, for example 0–1 in binary or 0–F in hexadecimal.

  3. Add the digits

    The digit values are added in base 10 to give the digit sum S(n).

  4. Repeat to the root

    S(n) is summed again until one digit remains: the digital root, plus the 3 and 9 divisibility result.

Digit Sum Formula

The digit sum formula adds the base-10 digits di of n, and each digit can be extracted with di = ⌊n / 10i⌋ mod 10. 3 formulas cover the digit sum, its link with 9 and the digital root.

Digit Sum Formula with the Floor Function

S(n)=∑i=0⌊log⁡10n⌋(⌊n10i⌋ mod 10)S(n) = \sum_{i=0}^{\lfloor \log_{10} n \rfloor} \left( \left\lfloor \frac{n}{10^{i}} \right\rfloor \bmod 10 \right)

Digit Sum and Multiples of 9

n−S(n)=∑idi (10i−1)≡0(mod9)n - S(n) = \sum_{i} d_i\,(10^{i} - 1) \equiv 0 \pmod 9

Every power 10i leaves remainder 1 when divided by 9, so n and S(n) leave the same remainder. For 2,025: 2,025 − 9 = 2,016 = 9 × 224.

Digital Root Formula

dr⁡(n)=1+((n−1) mod 9),n≥1\operatorname{dr}(n) = 1 + \big((n - 1) \bmod 9\big), \quad n \ge 1
InteractiveSlide n and watch all 3 digit sum formulas update

Types of Digit Sums

There are 5 common types of digit sums: the plain digit sum, the digital root, the alternating digit sum, the digit sum in another base and the weighted digit sum. The calculator returns the first 4 types directly; the cross sum calculator covers alternating and weighted sums in detail.

InteractiveSame number, different bases, different digit sums

Plain digit sum

Add the digits once: S(98,765) = 35.

Digital root

Repeat until 1 digit remains: 35 → 8, so dr(98,765) = 8.

Alternating digit sum

Alternate + and − from the right: 9 − 1 + 2 − 1 = 9 for 1,219. Tests divisibility by 11.

Digit sum in base b

Write n in base b first: 2,025 is 11111101001 in binary, with a binary digit sum (Hamming weight) of 8.

Weighted digit sum

Multiply each digit by a weight before adding, as in ISBN-10 and Luhn check digits.

How to Calculate a Digit Sum by Hand

To calculate a digit sum by hand, write the number, add the digits from left to right and keep a running total. Here is the digit sum and digital root of 9,875:

  1. Write the digits: 9, 8, 7, 5.
  2. Add them: 9 + 8 = 17, 17 + 7 = 24, 24 + 5 = 29.
  3. The digit sum is 29.
  4. Add the digits of 29: 2 + 9 = 11.
  5. Add again: 1 + 1 = 2. The digital root is 2.

A shortcut called casting out nines drops every 9 and every group of digits that adds up to 9: in 9,875, drop the 9, then 8 + 7 + 5 = 20 and 2 + 0 = 2. The digital root is 2 either way.

InteractiveStep through a digit sum by hand

    Digit Sum Divisibility Rules for 3 and 9

    A whole number is divisible by 3 if its digit sum is divisible by 3, and divisible by 9 if its digit sum is divisible by 9. 61,857 has a digit sum of 6 + 1 + 8 + 5 + 7 = 27, and 27 = 9 × 3, so 61,857 = 9 × 6,873.

    The rule works for one reason: 10 ≡ 1 (mod 9), so every place value 1, 10, 100, 1,000… leaves remainder 1 and the number keeps the remainder of its digit sum. The same argument gives 2 rules in any base b: a number is divisible by b − 1 (and by every divisor of b − 1) exactly when its base-b digit sum is. In hexadecimal, the digit sum tests divisibility by 15, 5 and 3.

    • Divisible by 3: digit sum is 3, 6, 9, 12, 15… (example: 1,236 → 12).
    • Divisible by 9: digit sum is 9, 18, 27, 36… (example: 2,025 → 9).
    • Divisible by 6: divisible by 3 and the last digit is even (example: 1,236).
    • Not a divisibility test for 7: 7 does not divide 10 − 1 = 9, so the digit sum says nothing about 7.
    Interactive1 to 90 sorted by digital root

    Common Mistakes with Digit Sums

    • Stopping too early: the digit sum of 9,875 is 29, but the digital root needs 2 more rounds (29 → 11 → 2).
    • Confusing the digit sum with the number of digits: 1,000,000 has 7 digits but a digit sum of 1.
    • Using the 3 and 9 rule in the wrong base: in hexadecimal the digit sum tests 15, 5 and 3, not 9.
    • Trusting casting out nines too far: a swapped pair of digits (e.g. 2,726,784 written 2,727,684) keeps the same digit sum, so the check passes on a wrong answer.
    • Rounding big numbers: spreadsheets store about 15 significant digits under IEEE 754, so the digit sum of a 20-digit number typed as a number is wrong.
    InteractiveTrue or false: digit sums
    1. The digital root of 123,456,789 is 9.

    2. A number with digit sum 21 is divisible by 9.

    3. Swapping 2 digits of a number changes its digit sum.

    4. The digit sum of a number and the number leave the same remainder when divided by 9.

    5. In base 2, the digit sum counts the 1 bits.

    Score: 0 / 5

    How to Use the Digit Sum Calculator

    Type or paste the number, set the base, pick Digit sum, Digital root or Sum of 1 to N, and press Calculate. The result card shows the answer, the divisibility tests and 3 tabs: the step-by-step working, a chart of how often each digit appears and a digit-by-digit table with a running sum.

    InteractiveLoad a ready-made digit sum

    Each button fills the calculator and runs it.

    1. Enter the number

      Paste up to 100,000 digits. Separators such as 1,234,567 or 1 234 567 are fine.

    2. Set the base

      Leave 10 for ordinary numbers; use 2, 8 or 16 for binary, octal or hexadecimal.

    3. Choose what to find

      Digit sum, Digital root, or Sum of 1 to N (the total of every digit sum from 1 to N).

    4. Read the tabs

      Steps show each round of adding, Digit counts show the digit frequency, Table shows the running sum.

    Real-Life Uses of Digit Sums

    Digit sums check arithmetic, validate ID numbers and appear in puzzles and numerology. There are 5 common uses:

    • Casting out nines: accountants and students check a sum or product by comparing digital roots, a method described by Leonardo of Pisa (Fibonacci) in Liber Abaci (1202).
    • Check digits: the Luhn algorithm (credit cards) and ISBN-10 add weighted digits to catch typing errors.
    • Divisibility tests: a quick test for 3 and 9 before long division.
    • Puzzles and contests: Project Euler problems 16 and 20 ask for the digit sums of 21000 and 100!.
    • Numerology: birth dates are reduced to a single digit with the digital root, for example 1990-07-15 → 32 → 5.
    InteractiveCasting out nines: check a multiplication

    Digit Sum Examples

    Digit sums and digital roots of common numbers.

    Digit Sum Examples
    NumberBaseDigit sumDigital rootCalculator
    4,73910235
    98,76510358
    2,0251099
    123,456,78910459
    2¹⁰⁰101157
    11010111261
    7778217

    Popular Digit Sum Problems

    Try each one, then reveal the answer or solve it in the calculator.

    1. Find the digit sum of 7,654,321.

      Show answer28 (digital root 1)
    2. Find the digital root of 9,875.

      Show answer29 → 11 → 2, so the digital root is 2
    3. Is 61,857 divisible by 9?

      Show answerYes: the digit sum is 27, and 61,857 = 9 × 6,873
    4. How many 1 bits does the binary number 11010111 have?

      Show answer6 (the binary digit sum)
    5. Add the digit sums of every whole number from 1 to 1,000.

      Show answer13,501
    6. Find the digit sum of 2¹⁰⁰ = 1,267,650,600,228,229,401,496,703,205,376.

      Show answer115

    Explore More Sum Calculators

    Discover 67 free sum calculators across different categories. Find the right calculator for your needs.

    Browse All 67 Calculators
    Questions and answers

    Frequently Asked Questions

    What is a digit sum calculator?

    A digit sum calculator is an online tool that adds the digits of a number and returns the digit sum, the digital root and the divisibility tests for 3 and 9. This calculator handles numbers up to 100,000 digits and bases 2 to 36.

    How do you find the digit sum of a number?

    Add every digit of the number once. The digit sum of 5,083 is 5 + 0 + 8 + 3 = 16.

    What is the difference between a digit sum and a digital root?

    The digit sum adds the digits once; the digital root keeps adding until one digit remains. For 5,083 the digit sum is 16 and the digital root is 1 + 6 = 7.

    Is a number divisible by 9 if its digit sum is divisible by 9?

    Yes, a whole number is divisible by 9 exactly when its digit sum is divisible by 9. 2,025 has digit sum 9, and 2,025 = 9 × 225.

    Does the digit sum test work for 7 or 11?

    No, the plain digit sum tests only 3 and 9 in base 10. Divisibility by 11 uses the alternating digit sum, and 7 needs a different rule.

    What is the digit sum of 2^1000?

    The digit sum of 2<sup>1000</sup> is 1,366, the answer to Project Euler problem 16. 2<sup>1000</sup> has 302 digits; paste them into the calculator to see every step.

    What is the sum of the digits of all numbers from 1 to 100?

    The digit sums of the numbers 1 to 100 add up to 901: 900 for 1 to 99, plus 1 for the number 100.

    Can the calculator find digit sums in binary or hexadecimal?

    Yes, set the base to 2 for binary, 8 for octal or 16 for hexadecimal. The hexadecimal number FF has a digit sum of 15 + 15 = 30.

    What is the digital root formula?

    The digital root of a positive whole number n is 1 + ((n − 1) mod 9), and the digital root of 0 is 0. For n = 9,875, (9,875 − 1) mod 9 = 1, so the digital root is 2.

    Conclusion

    A digit sum adds the digits of a number, and the digital root repeats that addition until 1 digit remains. The digit sum calculator returns both for numbers of any length and any base from 2 to 36, tests divisibility by 3 and 9, and totals the digit sums from 1 to N.

    Not sure which result you need? Answer 3 questions below.

    InteractiveWhich digit sum do you need?