Check whether a number is prime, and see the nearest primes. Enter a whole number.
Usage Tip
To test a small number, you only need to check division by primes up to its square root.
Tested by trial division up to the square root
Composite numbers have at least one divisor besides 1 and themselves.
1 is neither prime nor composite by definition.
The next and previous primes are shown for context.
A prime number is a whole number greater than 1 whose only factors are 1 and itself. The first primes are 2, 3, 5, 7, 11, and 13, and 2 is the only even prime. To test a number, you only need to check for divisors up to its square root, since any larger factor pairs with a smaller one.
The calculator also shows the nearest primes on either side, which is useful for choosing gear tooth counts, hash table sizes, or spacing patterns that avoid common factors. The number 1 is not prime, and there are infinitely many primes. Primes thin out as numbers grow, but they never run out, and very large primes are central to modern encryption.
