Overview
Enter a whole number to check whether it's prime - divisible only by 1 and itself. The check uses trial division up to the square root of the number, which is fast and exact for any number within JavaScript's safe integer range. If the number isn't prime, the smallest factor that disqualifies it is shown, so you can see exactly why rather than just getting a yes/no answer. Runs entirely client-side.
Best for: Quickly checking whether a number is prime without doing trial division by hand
How to use this tool
- Enter a whole number. Any positive or negative integer.
- Trial division runs instantly. Checked for divisibility up to the square root of the number - exact, not probabilistic.
- See the result and why. If it's not prime, the smallest factor that disqualifies it is shown.
Frequently asked questions
Up to JavaScript's maximum safe integer (about 9 quadrillion). Trial division up to the square root stays fast even near that limit, but numbers beyond it can't be represented exactly enough to check reliably.
No - by definition, prime numbers are positive integers greater than 1 with exactly two divisors (1 and themselves). 0, 1, and all negative numbers are correctly reported as not prime.