Prime Number Calculator

Check whether a number is prime, and see the nearest primes. Enter a whole number.

Result
Prime or composite.

Usage Tip

To test a small number, you only need to check division by primes up to its square root.

THE MATH
Prime: a whole number above 1 with exactly two divisors (1 and itself)
Tested by trial division up to the square root
Prime numbers are the building blocks of the integers; every whole number factors uniquely into primes.
Composite numbers have at least one divisor besides 1 and themselves.
2 is the only even prime; all other evens are composite.
1 is neither prime nor composite by definition.
The next and previous primes are shown for context.
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.