Prime Number Calculator

Enter a whole number to find out whether it is prime. If it is not, you see a factor pair, and you also get the nearest prime numbers.

A whole number from 1 to 1,000,000,000,000.

This result is an estimate only. Double-check important figures before relying on them.

How it is calculated

  • The calculator tries to divide the number by 2, then by odd numbers 3, 5, 7, … up to its square root
  • If none divides it evenly, the number is prime
  • The first divisor found is the smallest factor, and it gives the factor pair
  • The previous and next primes are found by testing the numbers around it the same way

To break a number into prime factors, use the prime factorization calculator. For common factors, use the GCF calculator.

Worked example

  • 97: no number from 2 to 9 divides it, so it is prime. The previous prime is 89 and the next is 101.
  • 91: it is divisible by 7, since 7 × 13 = 91, so it is composite.

Why your number may differ

The calculator accepts whole numbers up to one trillion. For much larger numbers, special methods are needed, which are beyond this page.

Frequently asked questions

What is a prime number?

A prime number is a whole number greater than 1 whose only factors are 1 and itself. The first primes are 2, 3, 5, 7, 11 and 13.

Is 1 a prime number?

No. A prime has exactly two different factors, and 1 has only one. So 1 is neither prime nor composite.

Is 2 the only even prime?

Yes. Every other even number is divisible by 2, so it has a factor besides 1 and itself.