Prime Number Checker
Enter a whole number to see if it is prime. Composite numbers are broken into prime factors.
Result
- Number of divisors
- 2
- Previous prime
- 7,907
- Next prime
- 7,927
How to use the prime number checker
Type or paste a whole number. The result says whether it is prime or composite. For composite numbers the checker shows the prime factorisation, the smallest prime factor and how many divisors the number has. The previous and next prime are shown for any input.
Method
Small factors are removed by trial division. The remaining cofactor is tested with the Miller-Rabin test using a fixed set of bases that is proven correct for every number below 3.3 × 10^24, so the answer is exact rather than probabilistic. Composite numbers are factorised with trial division and then Pollard’s rho algorithm. The number of divisors comes from the exponents in the factorisation: if n = p₁^a × p₂^b × …, it has (a + 1)(b + 1)… divisors.
Worked example
561 is not prime. It equals 3 × 11 × 17, so it has (1 + 1)(1 + 1)(1 + 1) = 8 divisors, and its smallest factor is 3. It is the smallest Carmichael number, which fools simple Fermat tests, but not the test used here. For comparison, 7919 is the 1000th prime.
Limits
- The input must be a whole number of 24 digits or fewer.
- For very large composites with only large prime factors, factorisation may stop early. The tool then shows the part it found and the unfactored remainder.
- 0 and 1 are neither prime nor composite.
- Everything runs in your browser. The number is not sent anywhere.
Frequently asked questions
Is 1 a prime number?
No. A prime has exactly two positive divisors, 1 and itself. The number 1 has only one divisor, so it is neither prime nor composite.
Why is 2 the only even prime?
Every other even number is divisible by 2, so it has at least three divisors (1, 2 and itself).
How large a number can I test?
Numbers up to about 3.3 × 10^24 (24 digits) are tested exactly. Very large composites may only be partly factorised, and the tool tells you when that happens.
Sources and methodology
Last reviewed 2026-12-04