Skip to content

Prime Number Checker

Type a whole number to find out whether it is prime, why, and which primes come just before and after it.

Any whole number up to 20 digits.

Try

Is 221 prime?

Not prime

221 is not prime: it is divisible by 13 (221 = 13 × 17).

Primes are shaded; your number is outlined.
Previous prime
211
Next prime
223
Prime factors
13 × 17

How to check whether a number is prime

A prime has exactly two factors, 1 and itself. To test n, try dividing it by the primes 2, 3, 5, 7, 11 … up to √n. If none divides it, n is prime; if one does, it is composite. You can stop at the square root because factors pair up: if n = a × b, one of a and b is at most √n.

For 221, √221 ≈ 14.9, so only 2, 3, 5, 7, 11 and 13 need trying. The first five leave remainders, but 221 ÷ 13 = 17 exactly, so 221 = 13 × 17 is not prime. Quick checks rule out most numbers: even numbers above 2, numbers ending in 5 or 0, and numbers whose digits add to a multiple of 3.

For very large numbers trial division would take far too long, so this checker switches to the Miller–Rabin test. With the first 13 primes as witnesses it gives a proven answer, with no chance of error, for every number below 3.3 × 10²⁴, which covers everything you can type here.

n is prime ⇔ n > 1 and no prime p ≤ √n divides n

How many primes there are

Primes up to each power of ten, counted with a sieve; they thin out, but never stop.

Primes up to each power of ten, counted with a sieve; they thin out, but never stop.
Up toPrimesLargest primeShare of numbers
104740%
50154730%
100259725%
5009549919%
1,00016899716.8%
10,0001,2299,97312.29%
100,0009,59299,9919.59%
1,000,00078,498999,9837.85%

Frequently Asked Questions

Is 1 a prime number?

No. A prime has exactly two different factors, and 1 has only one. Leaving 1 out keeps prime factorizations unique: otherwise 6 = 2 × 3 = 1 × 2 × 3 = 1 × 1 × 2 × 3 …

Is 2 the only even prime?

Yes. Every other even number is divisible by 2, so it has at least three factors (1, 2 and itself).

Is 91 prime?

No, although it looks it: 91 = 7 × 13. It is a classic trap because it is odd, doesn’t end in 5, and its digits add to 10, so the quick checks for 2, 3 and 5 all pass.

Are there infinitely many primes?

Yes. Euclid proved it: multiply any finite list of primes together and add 1; the result leaves remainder 1 when divided by each of them, so its prime factors are new primes.