Prime number checker
Type a number and see at once whether it is prime. If it is not, you get its smallest divisor and the full prime factorisation, plus the prime before and after it. Choose List primes for every prime up to a limit of your choice. Everything runs in your browser.
A whole number from 0 to 1,000,000,000,000,000 (10^15).
A whole number from 2 to 1,000,000.
Fill in the fields; the answer appears here straight away.
How it's worked out
How it works
-
Enter the values
Type the numbers or the formula. Decimals may use a point or a comma. No idea? Click Fill in an example.
-
Instant answer
The answer appears as you type, with the most important intermediate values.
-
See the working
Under "How it's worked out" you see the steps, handy for checking your own calculation.
What is a prime number?
A prime number is a whole number greater than 1 that is divisible only by 1 and by itself. The first ten are 2, 3, 5, 7, 11, 13, 17, 19, 23 and 29. A number that has other divisors, such as 91 (7 × 13), is called composite. 91 is a well-known trap: it looks prime, but it is not.
Examples
- 97 is prime: its square root is about 9.8 and none of 2, 3, 5 or 7 divides it. No need to look further.
- 91 is composite, because 91 = 7 × 13.
- 360 is composite and breaks down into 2³ × 3² × 5.
- 1,000,003 is the first prime above a million. The prime before it is 999,983.
How many primes are there?
Infinitely many; Euclid proved that over 2,000 years ago. They do thin out, though. There are 25 below 100, 168 below 1,000, 1,229 below 10,000 and 78,498 below a million. The List primes option lets you see this yourself, up to a million. The largest known prime is a Mersenne prime of more than 41 million digits (2^136,279,841 − 1, found in 2024).
Handy shortcuts
- A number ending in 0, 2, 4, 5, 6 or 8 is never prime, except 2 and 5.
- If the digits add up to a multiple of 3, the number is divisible by 3. For 51, 5 + 1 = 6, so 51 = 3 × 17.
- Two primes that differ by two, like 11 and 13 or 41 and 43, are called twin primes.
Want all the divisors of a number, not only the primes? Use factors of a number. With the prime factors of two numbers you can also find their greatest common divisor.
Frequently asked questions
Is 1 a prime number?
No. A prime has exactly two divisors: 1 and itself. The number 1 has only one divisor, so it is left out. That keeps the prime factorisation of every number unique. The first prime is 2, which is also the only even prime.
How does the tool decide whether a number is prime?
It tries to divide the number by 2, 3 and every number of the form 6k ± 1, up to the square root of the number. If none divides it exactly, the number is prime. A larger divisor would always pair with a smaller one, so searching beyond the square root is pointless.
How large can the number be?
Up to 10^15, a 1 followed by fifteen zeros. Above that a browser can no longer keep integers exact. For giants you need specialised software, like the projects that search for primes with millions of digits.
Why do prime numbers matter?
Every whole number above 1 is the product of primes in exactly one way, such as 360 = 2³ × 3² × 5. Encryption such as RSA relies on it: multiplying two big primes is quick, but splitting the product back into its primes is practically impossible for large numbers.