Prime Number Calculator

Check if a number is a prime number, and find the nearest primes before and after.

Is 17 a prime number?
Yes
Only divisible by 1 and itself
Previous prime
13
Next prime
19
Embed on your website →

How to use the prime number calculator

  1. Enter a whole number (0 or higher).
  2. The calculator shows whether the number is a prime.
  3. If it isn't prime, the smallest factor that divides it is shown. The calculator also shows the nearest primes before and after.

What is a prime number?

A prime number is a whole number greater than 1 that's only divisible by 1 and itself, with no remainder. The first ten primes are 2, 3, 5, 7, 11, 13, 17, 19, 23 and 29. Numbers that aren't prime (other than 0 and 1) are called composite numbers, and can always be broken down into two or more prime factors.

The calculator checks whether the number is divisible by anything up to its square root — an efficient method, since any factor larger than the square root always has a matching factor smaller than the square root.

Ad space — reserved for future partners

Frequently asked questions

Is 1 a prime number?

No. By definition, a prime number must have exactly two distinct positive factors (1 and itself). The number 1 has only one factor (itself), so it's considered neither prime nor composite.

Is 2 the only even prime number?

Yes. Every other even number is divisible by 2 in addition to itself and 1, and is therefore a composite number. 2 is thus the only even prime — all other primes are odd.

Is there a largest prime number?

No. Euclid already proved around 300 BC that there are infinitely many primes. The largest known primes today have millions of digits and are found using specialized software and distributed computing.

Embed this calculator on your website

Copy the code below to show this calculator directly on your blog or website — completely free.