Skip to content
SacaCuenta

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.

FreeNo sign-upInstant resultsUpdated:

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.

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

ResultWhat it means
PrimeOnly divisible by 1 and itself
Not prime + divisorThe smallest prime that divides it, shown as n = divisor × quotient
Prime factorizationThe unique set of primes that multiply to n, e.g. 360 = 2³ × 3² × 5
Previous and next primeThe 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.

  1. √97 ≈ 9.85, so you only need to test 2, 3, 5 and 7
  2. 97 ÷ 2, 97 ÷ 3, 97 ÷ 5 and 97 ÷ 7 all leave a remainder, so 97 is prime
  3. 91 ÷ 7 = 13 with no remainder, so 91 is composite
  4. 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.