How to use Prime number checker
- Type a whole number in the prime number checker. Spaces, commas and underscores are ignored.
- Read the verdict: prime or not prime.
- For a composite number, see its prime factorization, such as 360 = 2³ × 3² × 5.
- Check the previous and next prime and the "How we know" explanation, then copy the answer.
Features
- Checks any whole number up to 2^64 - 1, about 1.8 x 10^19
- Deterministic Miller-Rabin test, so the answer is exact, not probable
- Prime factorization of composite numbers, including large ones
- Previous prime and next prime
- Trial-division explanation for numbers below 10^12
- Runs in your browser with no daily limit
Examples
| Input | Result |
|---|---|
| 97 | Prime — No prime up to its square root (9) divides it. |
| 91 | Not prime: 7 × 13 — 91 / 7 = 13. |
| 360 | Not prime: 2³ × 3² × 5 — 8 x 9 x 5 = 360. |
| 7919 | Prime — The 1000th prime number. |
| 2305843009213693951 | Prime — 2^61 - 1, a Mersenne prime. |
Limitations
- Numbers above 2^64 - 1 (18,446,744,073,709,551,615) are not accepted.
- Factoring a large number that is the product of two huge primes can take a while, and in rare cases the tool shows the part it could not split.
- 0 and 1 are not prime.
- The explanation lists divisors only for numbers below 10^12. Larger numbers are decided by the Miller-Rabin test.
Learn more
A prime number is a whole number greater than 1 that has no divisors other than 1 and itself. Numbers that are not prime are called composite, and every composite number can be written as a product of primes in exactly one way, which is the fundamental theorem of arithmetic.
The simplest check is trial division. To test n, try dividing by 2 and then by odd numbers up to the square root of n. If none divides it, n is prime. You can stop at the square root because divisors come in pairs: if n = a x b, one of a and b is at most the square root of n. To test 97, for example, you only need to try 2, 3, 5 and 7, since 9 x 9 = 81 is below 97 and 10 x 10 = 100 is above it.
Trial division becomes slow for numbers with many digits. This tool switches to the Miller-Rabin test, which checks special properties of a number with a few chosen bases. With the first 12 primes as bases the verdict is proven correct for every number below 2^64, so there is no chance of a wrong answer in this range.
Frequently asked questions
What is a prime number?
A whole number greater than 1 whose only divisors are 1 and itself. The first primes are 2, 3, 5, 7, 11 and 13.
Is 1 a prime number?
No. A prime needs exactly two different divisors, and 1 has only one. That is also why every number has a unique prime factorization.
How does the tool check very large numbers?
It uses the Miller-Rabin test with 12 fixed bases, which is proven to give the correct answer for every number below 2^64.
Why do I only need to test divisors up to the square root?
If a number has a divisor larger than its square root, the matching partner divisor is smaller than the square root, so it would have been found already.
Is 2 the only even prime?
Yes. Every other even number is divisible by 2, so it has a divisor besides 1 and itself.
Sources
- Miller-Rabin primality test (Wikipedia)
- OEIS A014233 - smallest strong pseudoprime bounds for the first primes as bases
Last reviewed: October 1, 2026