Prime Number Checker

NUMBER THEORY
Result
Smallest divisor (above 1)
Next prime above
Previous prime below

Is this number prime?

A prime number has exactly two divisors — 1 and itself — which makes it a building block that cannot be broken into smaller factors. This checker tells you whether your number is prime, and if it is not, gives its smallest divisor along with the nearest primes above and below.

How the test works

To decide, the calculator tries dividing by 2 and then each odd number upward. If none divides evenly before the test value passes the square root, the number is prime. Checking only up to the square root is enough, because any factor larger than it must pair with a smaller one already tested.

A few rules worth knowing

One is not prime — it has only a single divisor. Two is the only even prime, since every other even number is divisible by 2. Every whole number above 1 is either prime or a product of primes, which is what makes primes so central to number theory.

Related tools

If the number is composite, the prime factorization calculator shows its full breakdown; for shared factors, the GCD and LCM calculator.

Worked example

97 has no divisor up to its square root (just under 10), so it is prime. The next prime above is 101 and the previous one below is 89.

FAQ

Why check only up to the square root?

Divisors come in pairs that multiply to the number. One of each pair is at or below the square root, so if none is found there, none exists anywhere.

Is 1 prime?

No. A prime needs exactly two distinct divisors, and 1 has only itself, so it is classed as neither prime nor composite.

Spotted an error or have a suggestion for this calculator? Let us know →
Scroll to Top

The calculators and tools on Formula Factory are provided for general guidance and informational purposes only. Results are estimates based on standard formulas and the values you enter — they do not constitute professional engineering, electrical, or architectural advice. Always verify calculations with a qualified professional before making decisions for any safety-critical, code-compliance, or commercial application. Formula Factory makes no representations or warranties as to the accuracy or completeness of any result, and accepts no liability for errors, omissions, or any outcomes arising from reliance on this information.