Prime Number Calculator
Check instantly whether a number is prime. If it isn't, you'll see a divisor that proves it and the full prime factorization, plus the nearest primes below and above.
Checker
Up to 9,007,199,254,740,991 (the largest integer a browser can handle exactly).
Is 97 prime?
Prime
Only divisible by 1 and itself
- Previous prime
- 89
- Next prime
- 101
Checked exactly with the deterministic Miller-Rabin test, which is valid for every whole number this tool accepts.
Keep analyzing
- List every factor of a whole number, its factor pairs and how many factors it has, plus its prime factorization and whether it's prime.Factors
- Find the greatest common factor of two or more whole numbers, with the Euclidean algorithm shown step by step and the prime factorization of each number.GCF
- Find the least common multiple of two or more whole numbers, with the steps using the GCF and the prime factorization method.LCM
For estimates only. Double-check the numbers before making important decisions.
What is a prime number?
A prime number is a whole number greater than 1 whose only divisors are 1 and itself: 2, 3, 5, 7, 11, 13 and so on. Every other whole number greater than 1 is composite, meaning it can be written as a product of smaller primes. 2 is the only even prime.
0, 1 and negative numbers are not prime. The calculator accepts them but always answers "not prime".
How the check works
For a small number, you only need to test divisors up to its square root: if nothing up to √n divides it evenly, it's prime. That gets slow for big numbers, so the calculator uses two faster methods:
- Miller-Rabin test with a fixed set of bases, which gives a definite yes or no (not a probability) for every number this tool accepts.
- Pollard's rho to find factors of large composite numbers without trying millions of divisions.
How to read the result
| Result | What it means |
|---|---|
| Prime | Only divisible by 1 and itself |
| Not prime + divisor | The smallest prime that divides it, shown as n = divisor × quotient |
| Prime factorization | The unique set of primes that multiply to n, e.g. 360 = 2³ × 3² × 5 |
| Previous and next prime | The closest primes below and above your number |
Prime numbers under 100
There are 25 primes below 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 and 97. There are 168 primes below 1,000.
Limits
You can check any whole number up to 9,007,199,254,740,991 (2⁵³ − 1), the largest integer a web browser can store exactly. The largest prime in that range is 9,007,199,254,740,881. Everything runs on your device; nothing is sent to a server.
Example
97 is prime: none of the primes below √97 (2, 3, 5 and 7) divide it evenly. 91 is not prime: it looks prime, but 91 = 7 × 13.
- √97 ≈ 9.85, so you only need to test 2, 3, 5 and 7
- 97 ÷ 2, 97 ÷ 3, 97 ÷ 5 and 97 ÷ 7 all leave a remainder, so 97 is prime
- 91 ÷ 7 = 13 with no remainder, so 91 is composite
- Nearest primes to 97: 89 below and 101 above
Common mistakes
- Counting 1 as prime. By definition a prime has exactly two different divisors, and 1 has only one.
- Assuming every odd number is prime. 9, 15, 21, 91 and 221 (13 × 17) are all composite.
- Testing divisors past the square root. If no divisor turns up by √n, there isn't one.
Frequently asked questions
Is 1 a prime number?
No. A prime must have exactly two different divisors, 1 and itself. The number 1 has only one divisor, so it is neither prime nor composite.
Is 2 a prime number?
Yes. 2 is the smallest prime and the only even one. Every other even number is divisible by 2, so it can't be prime.
How do I know if a number is prime?
Divide it by each prime up to its square root. If none of them divides it evenly, the number is prime. For large numbers, enter it in the calculator above and you'll get an exact answer instantly.
What is the largest prime number?
There isn't one. Euclid proved more than 2,000 years ago that there are infinitely many primes. The largest known primes are Mersenne primes with tens of millions of digits.
Is 2,147,483,647 prime?
Yes. It equals 2³¹ − 1, a Mersenne prime, and it's also the largest value of a signed 32-bit integer in programming.
Related calculators
Keep going with the next step.
- FactorsList every factor of a whole number, its factor pairs and how many factors it has, plus its prime factorization and whether it's prime.
- GCFFind the greatest common factor of two or more whole numbers, with the Euclidean algorithm shown step by step and the prime factorization of each number.
- LCMFind the least common multiple of two or more whole numbers, with the steps using the GCF and the prime factorization method.