Prime Number Calculator

Check if a number is prime and find its prime factors.

Any whole number from 0 to 9,007,199,254,740,991.

Try an example

Is it prime?

Not prime (composite)

91 is not prime: 91 = 7 × 13.

Prime factorization
7 × 13
Written out
7 × 13
Smallest prime factor
7
Number of divisors
4
Previous prime
89
Next prime
97

Fix the highlighted field to update the result.

Ladder method

Divide by the smallest prime until the quotient is prime
StepDivision
÷ 791 ÷ 7 = 13
Prime left13 is prime, so stop

How to use

  1. Enter a whole number from 0 to 9,007,199,254,740,991.
  2. See at once whether it is prime, its prime factorization, and the previous and next primes.
  3. Below the result, the ladder method shows each division.

How the prime check works

A prime is a whole number above 1 whose only divisors are 1 and itself. A composite number has other divisors. 0 and 1 are neither.

The calculator tries divisors in order: 2, 3, then 5, 7, 11, 13 and so on. Above 3, only numbers one away from a multiple of 6 can be prime, so only those are tested.

It stops once the divisor passes √n. If nothing divides evenly by then, n is prime, because any factor pair has one factor no bigger than √n.

The result is exact, not a “probably prime” guess.

Examples

  • 91: 91 ÷ 7 = 13, so 91 = 7 × 13. It is odd and not a multiple of 3 or 5, which makes it a common trap.
  • 97: no whole number from 2 to 9 divides it, and √97 ≈ 9.85, so 97 is prime.
  • 360: divide by 2 three times, then by 3 twice, leaving 5: 360 = 2³ × 3² × 5.
  • 1,001: 1,001 = 7 × 11 × 13.

Numbers that look prime but aren’t

Number Prime? Factors
51 No 3 × 17
57 No 3 × 19
87 No 3 × 29
91 No 7 × 13
119 No 7 × 17
221 No 13 × 17
97 Yes 97

The 25 primes below 100 are 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.

Why 1 isn’t prime, and the largest number

Leaving 1 out keeps every prime factorization unique. If 1 were prime, 6 could be written as 2 × 3, 1 × 2 × 3, 1 × 1 × 2 × 3 and so on.

The limit, 9,007,199,254,740,991 (2⁵³ − 1), is the largest whole number a browser stores exactly. The largest prime below it is 9,007,199,254,740,881. On slow devices, very large numbers may stop after a few seconds with a message.

To find the common factors of two or more numbers, use the GCF and LCM calculator.

Frequently asked questions

Is 1 a prime number?

No. A prime needs exactly two positive divisors, and 1 has only one. Leaving 1 out also keeps every number’s prime factorization unique.

Why is 2 the only even prime?

Every other even number is divisible by 2, so it has at least three divisors: 1, 2 and itself. That makes every even number above 2 composite.

How do I check if a number is prime?

Divide it by 2, 3, 5, 7 and so on. If nothing divides evenly by the time the divisor passes √n, the number is prime. For 97, testing 2, 3, 5 and 7 is enough.

Is 91 prime?

No: 91 = 7 × 13. It’s a common trap because it is odd and passes the quick checks for 3 and 5.

What is prime factorization?

Writing a number as a product of primes, such as 360 = 2³ × 3² × 5. Every whole number above 1 has exactly one such factorization, apart from the order of the factors.

What is the largest number this calculator can check?

9,007,199,254,740,991 (2⁵³ − 1), the largest whole number a browser stores exactly. The largest prime below that is 9,007,199,254,740,881.