Part of the Maths & Statistics suite · 235 calculators

Prime Number Calculator

Test whether a number is prime, and find the primes on either side of it.

A prime has exactly two divisors: one and itself.

Results update as you type
Results
Prime?
Yes, 97 is prime
Reason
Previous prime
Next prime
Gap between them
Smallest divisor above 1
Reviewed September 2026. Pure mathematics: the result does not depend on where you are. Terminology follows the national curriculum (maths, brackets, decimal point).
No account required · Google Analytics off unless allowedCalculator arithmetic runs in your browserResults update as you type
All calculations run 100% in your browser. The calculator code does not submit your figures to GlobalCalc to obtain a result.
About prime number

How the prime number calculator works

A prime has exactly two divisors: one and itself. One is not prime — it has only a single divisor — and that exclusion is what makes prime factorisation unique.

Testing is quick because a composite number must have a factor no larger than its square root. Checking 2, then odd numbers up to √n, settles the question in a few dozen steps even for numbers in the millions.

Formula: n is prime if no integer from 2 to √n divides it

Worked examples

InputsPrime?Note
Is 97 prime?Yes, 97 is primeyes
Is 91 prime?No, 91 is not primeno — 7 × 13
Is 1 prime?No, 1 is not primeno, by definition

Frequently asked questions

Is 1 a prime number?

No. A prime has exactly two distinct divisors; one has only itself. Excluding it is what makes every number factor into primes in exactly one way.

Is 2 prime?

Yes — and it is the only even prime, since every other even number is divisible by 2.

How do I check if a number is prime?

Try dividing by 2, then by odd numbers up to its square root. If none divide it, it is prime.

Why only up to the square root?

Because if n = a × b and both were larger than √n, their product would exceed n.

What is the largest known prime?

A Mersenne prime with over 41 million digits, found in 2024. Numbers that size are tested with specialised algorithms, not trial division.

Where these figures come from

Last checked: September 2026. Formulas are fixed by mathematics and do not change with tax years or regulations.