Skip to content
FiftyCalc Free calculators for all 50 states

Sum of Digits Calculator

Test cases replayed : 5 of 5 match · Methodology · No outside source listed

Enter a whole number (up to 15 digits) to add up its digits.

Result

Sample figures

Sum of the digits—

Number used (absolute value, rounded to a whole number) —

  • Number of digits—
  • Alternating digit sum (units digit +, tens −, …)—
  • Digital root (repeat the digit sum until one digit is left)—

Estimate for planning only, not tax, legal, financial or medical advice. This calculator uses the method explained on this page.

Sum of Digits Calculator

Whole number (up to 999,999,999,999,999): enter a number. Prefilled example: 98,765.

How to use this calculator

Fill in the fields in this order; each step takes you to its field.

  1. Whole number (up to 999,999,999,999,999): enter a number.
  2. Read the result: Sum of the digits; the panel also shows Number used (absolute value, rounded to a whole number), Number of digits, Alternating digit sum (units digit +, tens −, …) and Digital root (repeat the digit sum until one digit is left).

How this calculator works

The digit sum adds the decimal digits of the number: the units digit, the tens digit, and so on. The calculator reads each digit as floor(n ÷ 10ᵏ) mod 10 for k = 0 to 15.

Divisibility rules use it: a number is divisible by 3 (or 9) exactly when its digit sum is. The alternating sum, units minus tens plus hundreds and so on, is divisible by 11 exactly when the number is.

Adding the digits again and again until one digit remains gives the digital root, which equals 1 + (n − 1) mod 9 for n > 0.

Worked example

Whole number (up to 999,999,999,999,999)98,765
Sum of the digits35
Number of digits5
Alternating digit sum (units digit +, tens −, …)7
Digital root (repeat the digit sum until one digit is left)8

Frequently asked questions

What is the sum of the digits of 98765?

9 + 8 + 7 + 6 + 5 = 35, and its digital root is 3 + 5 = 8.

How does the digit sum test divisibility by 9?

A number is divisible by 9 when its digit sum is. 123,456,789 has digit sum 45, so it is divisible by 9.

Why is the limit 15 digits?

Larger whole numbers cannot be stored exactly in the floating-point numbers a browser uses, so their last digits would be unreliable.

Related calculators