Skip to content
CalculatPage

Prime Number Calculator

Test whether a number is prime and see its prime factorization along with neighboring primes.

Updated November 2026 · How we build calculators

Result

Your result will appear here

Enter your numbers, then press Calculate.

How the Prime Number Calculator works

The calculator tests divisibility by every integer up to the square root of the number. If none divide it, the number is prime. Prime factorization repeatedly divides by the smallest factor.

Formula used

n is prime if no integer from 2 to √n divides n evenly

Step-by-step example

Using the default values in the calculator above:

  1. Number: 97

The calculator then applies the formula above and returns:

  • 97 is: a prime number
  • Prime factorization: 97
  • Previous prime: 89
  • Next prime: 101

Tips and background

Every integer above 1 is either prime or a unique product of primes, which is called the fundamental theorem of arithmetic.

How to tell if a number is prime

A prime has exactly two factors: 1 and itself. To test n, try dividing by every prime up to √n; if none divide evenly, it is prime. 97 is prime because it is not divisible by 2, 3, 5 or 7. The only even prime is 2, and 1 is neither prime nor composite.

Prime factorization and why primes matter

Every integer above 1 breaks into primes in exactly one way (180 = 2² × 3² × 5). That uniqueness is the basis of modern encryption. Factorizations help find the GCF and LCM of numbers, and you can explore ranges of numbers with the random number generator.

Which numbers look prime but are not?

NumberFactorizationNext prime
917 × 1397
22113 × 17223
1802^2 × 3^2 × 5181

Numbers such as 91 are easy to mistake for primes because they do not divide by 2, 3 or 5.

How far do you need to test?

You only need to try divisors up to the square root of the number. If a number had two factors both larger than its square root, multiplying them would give something bigger than the number. For 221 the square root is just under 15, so testing primes up to 13 is enough, and 13 divides it. The smallest prime is 2. The number 1 is neither prime nor composite, while 997 is prime.

Common mistakes to avoid with the Prime Number Calculator

  • Calling 1 a prime.
  • Assuming all odd numbers are prime (9 and 15 are not).
  • Stopping the divisibility test too early.

Frequently asked questions

Is 1 a prime number?

No. A prime must have exactly two distinct factors.

Is 2 prime?

Yes, it is the only even prime.

Why do primes matter?

They underpin modern encryption.

What are the first ten prime numbers?

2, 3, 5, 7, 11, 13, 17, 19, 23, 29.

How many primes are there?

Infinitely many, as Euclid proved over two thousand years ago.