Math Calculators

Prime Number Checker

Check if a number is prime and list primes in any range.

—
—Previous prime
—Next prime

List primes in a range

What is a prime number?

A prime number is a whole number greater than 1 that can only be divided exactly by 1 and itself. The first primes are 2, 3, 5, 7, 11, 13, 17, 19, 23 and 29. A number with other divisors, such as 12 (divisible by 2, 3, 4 and 6), is called composite. Primes are the building blocks of all whole numbers, and they protect your online banking and shopping, because modern encryption relies on how hard it is to split huge numbers into primes.

How to use the checker

  1. Type any whole number, even one with dozens of digits.
  2. See instantly whether it is prime. If not, the tool shows a divisor.
  3. Read the previous and next prime numbers.
  4. To see many primes at once, enter a range and click List primes.

How primality is tested

For small numbers, the simplest method is trial division: try dividing by every number up to the square root. If none divides exactly, the number is prime. For example, to test 97 you only need to try 2, 3, 5 and 7, because √97 ≈ 9.8.

For large numbers, trial division is far too slow, so this tool uses the Miller–Rabin test with the first twelve prime bases. That combination is proven correct for all numbers below about 3.3 × 10²⁴ and is extremely reliable beyond that. Prime lists in a range are produced with a segmented Sieve of Eratosthenes, an ancient Greek method that crosses out multiples of each prime.

Interesting facts

Frequently asked questions

Is 1 a prime number?

No. A prime must have exactly two different divisors, and 1 has only one.

How can I see all the prime factors of a number?

Use the Prime Factorization Calculator.

What are twin primes?

Pairs of primes that differ by 2, such as 11 and 13 or 41 and 43.