Prime number checker
Instantly check whether a number is prime and find its smallest divisor if it isn't, or generate the complete list of prime numbers up to a given limit. All calculation runs in your browser.
How it works
Useful for a math exercise, a quick check in basic cryptography, or simple curiosity, this tool tests a number's primality by trial division up to its square root — a simple and fast method for numbers up to about 1 trillion. List generation, meanwhile, uses a Sieve of Eratosthenes, which is much more efficient for finding all primes up to a given limit.
Why stop at the square root of the number?
If a number n has a divisor greater than its square root, it necessarily also has a complementary divisor smaller than that square root (their product being n). It's therefore pointless to test larger divisors: if none exist up to the square root, the number is prime.
Why is the list limited to 200,000?
Beyond that, the sieve array becomes large and the calculation, while still possible, would start to noticeably slow down your browser. This limit guarantees a near-instant result in all cases.
No number entered is sent to a server: the primality calculation is done entirely locally.