Prime Number Checker
Check whether a number is prime, see its smallest factor and full factorisation, and find the next and previous primes.
Up to 10^40. Decimals are refused rather than rounded.
How it works
- Enter a whole number. Separators like spaces, commas and underscores are ignored.
- Small numbers are tested by trial division; large ones by a Miller–Rabin test.
- The verdict, the method used and the factorisation are computed in your browser.
Frequently Asked Questions
How is primality tested?
Small numbers use trial division up to the square root, which also yields the smallest factor. Large numbers use a deterministic Miller-Rabin test with the first twelve primes as witnesses — a set proven exact for every value below 3.3 × 10²⁴, so the result is a definite answer and not "probably prime". The method used is always stated.
Is 1 prime?
No, and neither is 0 or any negative number — they are neither prime nor composite. A prime has exactly two distinct positive divisors; 1 has only itself. The tool explains this rather than just reporting "not prime".
How large a number can it handle?
Up to 10⁴⁰. Above that, deterministic testing is not practical in a browser, so the tool declines rather than appearing to hang. The Mersenne prime 2⁶¹ − 1 is verified in milliseconds.
Does it show factors?
Yes. Composites report their smallest factor, and a full prime factorisation with exponents is shown for values small enough to factor quickly.