Prime number checker
Is it prime? Instant answer, prime factorization, number of divisors and the nearest primes.
Runs entirely in your browser. Your files never leave your device.
About this tool
A prime number has exactly two divisors: 1 and itself. Type any whole number and the checker tells you at once whether it is prime. If it is not, you see its decomposition into prime factors, such as 360 = 2^3 × 3^2 × 5, and how many divisors it has.
The previous and next primes are shown too, which helps when you need a prime size for a hash table, a puzzle or a maths exercise on gaps between primes. The test runs in your browser and handles numbers up to ten trillion in a fraction of a second, by trying only the candidate divisors that can matter.
How it works
- Type a whole number.
- Read the verdict: prime, composite, or neither for 0 and 1.
- See the factorization, the divisor count and the neighbouring primes.
Divisors are tested up to the square root of the number, skipping multiples of 2 and 3. The divisor count comes from the exponents: (a+1)(b+1)… for n = p^a × q^b…
Worked example
Is 91 prime? It looks like it, but no: 91 = 7 × 13. Is 97 prime? Yes, the next prime after it is 101.
360 = 2^3 × 3^2 × 5 has (3 + 1) × (2 + 1) × (1 + 1) = 24 divisors, which is why it divides so nicely into degrees, hours and minutes. The primes around 1000 are 997 and 1009.
Good to know
- Every prime above 3 is one more or one less than a multiple of 6, a quick way to rule out candidates.
- A number is divisible by 3 when the sum of its digits is, and by 11 when the alternating sum of its digits is.
- 1 is not prime: a prime has exactly two divisors, and 1 has only one.