Skip to content
Prime Checker
Menu

Prime Number Checker

Type any whole number to find out if it's prime. If it isn't, you'll see how it factors, its divisors and the primes on either side.

Updated · exact integer math

Any whole number up to 24 digits. Commas are fine.

Try 1,000,003 or 561. Want a list instead? See the list of prime numbers.

Is 97 prime?

Yes, prime

Number of divisors
2
Previous prime
89
Next prime
101

Divisors: 1, 97

Its only divisors are 1 and 97, so it's prime.

How to tell if a number is prime

A prime number is a whole number greater than 1 whose only divisors are 1 and itself. To check one by hand:

  1. If it's 2, it's prime. If it's even (and not 2) or less than 2, it isn't.
  2. Work out its square root. You only need to test divisors up to that point.
  3. Divide by each prime up to the square root: 3, 5, 7, 11, 13…
  4. If none divides evenly, the number is prime.

Example: is 221 prime? √221 ≈ 14.9, so test 2, 3, 5, 7, 11 and 13. 221 ÷ 13 = 17, so 221 = 13 × 17. It's composite.

Why only up to the square root? If a number has a factor bigger than its square root, it must also have one smaller than it, and you'd have found that one first.

Quick shortcuts

More shortcuts, up to 12, are on the divisibility rules page.

How this checker works

Small numbers are checked by trial division. Larger ones use the Miller-Rabin test with the first 13 primes as bases, which is proven exact for every number below 3.3 × 10²⁴, so the answer here is never a guess. If the number is composite, it's factored with Pollard's rho method. Details are in how the checker works.

Looking for many primes at once? See the list of prime numbers or the prime numbers 1 to 100 chart.

Questions people ask

How do you check if a number is prime?

Divide by every prime up to its square root. If none divides evenly, it's prime. For 97: test 2, 3, 5, 7. None works, so 97 is prime.

Is 2 a prime number?

Yes, the smallest and the only even prime. More: is 2 a prime number.

What is the largest known prime number?

2^136,279,841 − 1, with 41,024,320 digits, found by GIMPS in October 2024.

How big a number can this checker test?

Up to 24 digits, where the method is proven exact, not just probable.

Sources

More prime number tools