Skip to content

Prime Number Checker

Check whether a number is prime. If it isn’t, see its prime factorization, smallest factor and divisors. You also get the primes just before and after it, and you can list every prime between two numbers.

Try:

Works for whole numbers up to 40 digits. Factorization is instant up to about 24 digits.

About this number

List the prime numbers between two numbers

Prime numbers from 1 to 100

There are 25 primes below 100. Highlighted numbers are prime.

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100

Next steps

Guide: GCF and LCM: how to find them, with examples

Key facts

Price
Free, with no sign-up and no usage limits
Privacy
Runs in your browser: your files and text are never uploaded
Works on
Any current browser on Windows, macOS, Linux, ChromeOS, Android and iPhone
Made by
Toolgu
Last updated

How to use the prime number checker

  1. Type any whole number up to 40 digits. The answer updates as you type.
  2. If it isn’t prime, you see its prime factorization (360 = 2³ × 3² × 5), its smallest prime factor and all of its divisors.
  3. The previous and next primes are shown either way. Below, list every prime between two numbers up to 10 million and copy the list.

Prime and composite numbers

A prime number has exactly two divisors: 1 and itself. A composite number has more, so it can be split into smaller factors. 0 and 1 are neither prime nor composite. Every whole number above 1 is either prime or a unique product of primes, which is why primes are called the building blocks of numbers.

Quick divisibility checks

  • 2: the last digit is even. 5: it ends in 0 or 5. 10: it ends in 0.
  • 3: the digits add up to a multiple of 3 (for 471, 4 + 7 + 1 = 12, so 471 = 3 × 157).
  • 11: the alternating sum of the digits is a multiple of 11 (for 2,728: 2 − 7 + 2 − 8 = −11).
  • You only need to test primes up to the square root: a number below 121 that isn’t divisible by 2, 3, 5 or 7 is prime.

Large primes

For big numbers, trial division is far too slow, so this checker uses the Miller–Rabin test. With the twelve bases it uses, the test is exact for every number below 3.3 × 10²⁴. Composite numbers are factored with Pollard’s rho method, which splits a 19-digit number like 1,000,000,016,000,000,063 = 1,000,000,007 × 1,000,000,009 in a fraction of a second. Large primes like these keep online banking and HTTPS secure, because multiplying two primes is easy but factoring the product back is very hard.

Prime factors are how you find the GCF and LCM of numbers. To convert numbers into binary or hex, use the binary converter.

Frequently asked questions

What is a prime number?

A whole number greater than 1 whose only divisors are 1 and itself. 2, 3, 5, 7, 11 and 13 are prime. 2 is the only even prime, since every other even number divides by 2.

Is 1 a prime number?

No. A prime has exactly two different divisors, and 1 has only one. Leaving 1 out also keeps prime factorizations unique.

How do I check if a number is prime?

Try dividing it by each prime up to its square root. If none divides evenly, it is prime. For 97, the square root is about 9.8, and 2, 3, 5 and 7 don’t divide it, so 97 is prime. This checker uses the Miller–Rabin test, which is instant even for 30-digit numbers.

What is prime factorization?

Writing a number as a product of primes, which can only be done one way. 360 = 2 × 2 × 2 × 3 × 3 × 5, or 2³ × 3² × 5. It is how you find the GCF and LCM.

How many prime numbers are there below 100?

There are 25 primes below 100, 168 below 1,000 and 78,498 below 1,000,000. There are infinitely many primes, as Euclid proved more than 2,000 years ago.