๐Ÿ”Ÿ Number of Digits Calculator

Count the number of decimal digits in a positive whole number.

No ratings yet โ€” be the first
Rate it: โ˜… โ˜… โ˜… โ˜… โ˜…

Enter details

Fill in the details and click Calculate to see your results.


Also available in our Android app, with charts and full breakdown tables.

๐Ÿ“˜ About the Number of Digits

This calculator counts digits in the ordinary base-10 representation.

It is intended for non-negative whole numbers.

๐Ÿงฎ Formula

Decimal digit count
digits = floor(log10(n)) + 1

Where

  • n = positive integer
  • digits = floor(log10(n)) + 1
Zero has one digit. Negative signs are not counted as digits.

โœ๏ธ Worked example

How many digits are in 123456?

You enter
Positive Whole Number123456
You get
Number of Digits6

There are 6 decimal digits.

Try this example โ†’

๐Ÿงญ How to use this calculator

What you enter

  • Positive Whole Number

What you get

  • Number of Digits

๐Ÿ’ก Examples

  • 9 has 1 digit.
  • 10 has 2 digits.
  • 1,000,000 has 7 digits.

โ“ Frequently asked questions

Does zero have one digit?

Yes. Zero is represented with one decimal digit.

Are commas counted?

No. Separators are not digits.

Can this count digits of a negative number?

Enter the positive magnitude for a digit count.