Prime Number Checker

Check if a number is prime, or list all primes up to a limit.

Result
—

Instantly check whether a number is prime, see its smallest factor if it isn't, or list every prime number up to a chosen limit using a sieve algorithm.

How to tell if a number is prime

You only need to test divisors up to the square root of the number. If nothing up to that point divides it evenly, nothing above it will either, because any larger factor would have to pair with a smaller one you've already tested.

For example, to check 97: its square root is about 9.8, so test 2, 3, 5 and 7. None of them divides 97 evenly, so 97 is prime. To check 91: the square root is about 9.5, and 91 ÷ 7 = 13, so 91 is not prime.

This checker uses the same method with one shortcut: every prime above 3 is one more or one less than a multiple of 6, so it only tests divisors of that form.

Quick divisibility tests

Divisible byIf…Example
2the last digit is even358
3the digits add up to a multiple of 3471 (4 + 7 + 1 = 12)
5the last digit is 0 or 5835
11alternately adding and subtracting the digits gives 0 or a multiple of 112,728 (2 − 7 + 2 − 8 = −11)

There's no quick rule for 7, which is why numbers like 91, 119 (7 × 17) and 133 (7 × 19) are easy to mistake for primes.

Prime numbers from 1 to 100

There are 25 primes under 100:

2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, 59, 61, 67, 71, 73, 79, 83, 89, 97

Pairs of primes that differ by 2 — such as 11 and 13, 17 and 19, or 41 and 43 — are called twin primes.

How many primes there are

Numbers up toPrimes
104
10025
1,000168
10,0001,229
100,0009,592
1,000,00078,498

Primes get rarer as numbers grow, but they never run out — Euclid proved more than 2,000 years ago that there are infinitely many. Large primes are what keep online banking and shopping secure: RSA encryption relies on the fact that multiplying two huge primes is easy, but splitting the result back into those primes is practically impossible.

Frequently asked questions

What is a prime number?

A whole number greater than 1 that has no divisors other than 1 and itself — 2, 3, 5, 7, and 11 are the first few.

Is 1 a prime number?

No — by definition, prime numbers must be greater than 1 and have exactly two distinct divisors. 1 has only one.

Is 2 a prime number?

Yes. 2 is the smallest prime and the only even one — every other even number can be divided by 2, so it has at least three divisors.

Is 0 a prime number?

No. Primes must be greater than 1, and 0 can be divided by every whole number except itself.

Is 91 a prime number?

No — 91 = 7 × 13. It's the most common trick question because it isn't even, doesn't end in 5, and its digits don't add up to a multiple of 3.

How many prime numbers are there under 100?

There are 25 primes under 100, from 2 up to 97. There are 168 under 1,000 and 78,498 under 1,000,000.

What is a composite number?

A whole number greater than 1 that isn't prime — it can be written as a product of smaller whole numbers, like 12 = 2 × 2 × 3. The numbers 0 and 1 are neither prime nor composite.

How large a number can this check?

Any whole number up to 9,007,199,254,740,991 — the largest whole number a web browser can store exactly. Checking takes at most a fraction of a second, even near that limit. The prime list goes up to 1,000,000.

What is the largest known prime number?

As of 2024, it is 2^136,279,841 − 1, a Mersenne prime with 41,024,320 digits, found in October 2024 by the Great Internet Mersenne Prime Search (GIMPS). There are infinitely many primes, so there is no largest one overall.