Prime Number Checker

Enter any whole number to find out whether it's prime. The checker also lists every factor, breaks the number into its prime factorization, and shows the previous and next prime numbers.

Enter a whole number, then press Check.

What makes a number prime

A prime number is a whole number greater than 1 whose only divisors are 1 and itself. The first few primes are 2, 3, 5, 7, 11, 13… Every other whole number greater than 1 is composite, meaning it can be written as a product of smaller primes.

n is prime no whole number from 2 to √n divides n

To test a number you only need to try divisors up to its square root: if no factor exists below √n, none exists above it either, because factors come in pairs. The number 2 is the only even prime; 0 and 1 are neither prime nor composite.

Worked example

Is 97 prime?

√97 ≈ 9.85, so test divisors 2, 3, 5, 7.
None divide 97 evenly (97 is odd, not a multiple of 3, 5 or 7).
Result: 97 is prime — its only factors are 1 and 97.

How the check works

This tool uses trial division: it checks 2, then every odd number up to √n. If a divisor is found, the number is composite and the tool reports the smallest factor and the full prime factorization (for example 84 = 2² × 3 × 7). It also lists all divisors and finds the nearest primes on either side. Very large numbers are capped to keep the page fast, since trial division grows with √n.

Tip: need the greatest common divisor of two numbers? Use the GCD & LCM calculator, or count arrangements with the permutation & combination calculator.

Frequently asked questions

Is 1 a prime number?

No. By definition a prime is greater than 1 and has exactly two distinct divisors. The number 1 has only one divisor (itself), so it's neither prime nor composite, and 0 isn't prime either.

Why only check up to the square root?

Because factors come in pairs that multiply to n. If n had a factor larger than √n, the matching factor would be smaller than √n and would already have been found. So testing up to √n is enough.

What is prime factorization?

It's writing a number as a product of primes, like 84 = 2 × 2 × 3 × 7. Every whole number greater than 1 has exactly one prime factorization (the Fundamental Theorem of Arithmetic).

Is there a largest prime?

No. Euclid proved over 2,000 years ago that primes are infinite. This checker is meant for everyday-sized numbers; it caps very large inputs because trial division slows as numbers grow.

MB
Mustafa Bilgic · Editor, Calcool
Uses trial division up to √n and the Fundamental Theorem of Arithmetic for prime factorization. Everything runs in your browser — nothing you enter is uploaded, logged or stored.

Related calculators