A prime number checker that shows the proof
Type any whole number into this prime number checker to find out instantly whether it is prime or composite. If it is composite you get its full prime factorisation (in exponent form, such as 48 = 2⁴ × 3), a drawn factor tree and a division ladder; either way you see the previous and next primes and the number of divisors. A second mode lists and counts every prime in a range, from the 25 primes below 100 to the 78,498 primes below one million.
The checker uses the same methods as number-theory software: trial division and the sieve of Eratosthenes for small numbers, a deterministic Miller–Rabin test for numbers up to 3.3 × 10²⁴, and Pollard’s rho algorithm to split large composites. It works on numbers with up to 300 digits, entirely inside your browser.
How to use the Prime Number Checker
- Choose Check a number or Primes in a range.
- To check a number, type it in — commas and spaces are ignored, so 1,000,003 is fine.
- Read the verdict, then the tiles: prime factorisation, smallest factor, number of divisors, previous prime and next prime.
- For a range, enter where to start and stop. The count, smallest and largest primes, twin-prime pairs and the full list appear below.
- For a composite number, study the factor tree (filled circles are the primes) and the ladder beside it.
- Open “How we know” to see why the answer is correct, and use “Copy list” to take the primes elsewhere.
Prime Number Checker features
Proven, not guessed
Below 3.3 × 10²⁴ the Miller–Rabin bases used are proven to catch every composite, so “prime” means prime.
Full factorisation
Composite numbers are broken into prime powers such as 2³ × 3² × 7, including 20-digit numbers via Pollard’s rho method.
Factor tree and ladder
Both methods taught in school are drawn for you: the tree splits off the smallest prime each time, and the ladder divides by primes until it reaches 1.
Nearest primes
The previous and next prime are found for any size of number — handy for hashing, cryptography exercises and puzzles.
Fast prime lists
A segmented sieve counts primes across ranges of up to 10 million numbers in a fraction of a second.
Explained results
Divisibility rules, the square-root limit for trial division and the prime number theorem are shown alongside the answer.
What is a prime number?
A prime number is a whole number greater than 1 whose only divisors are 1 and itself: 2, 3, 5, 7, 11, 13 and so on. A whole number greater than 1 that is not prime is composite — it can be written as a product of smaller numbers, like 221 = 13 × 17. The number 1 is neither, and 2 is the only even prime.
Every whole number above 1 can be written as a product of primes in exactly one way (the fundamental theorem of arithmetic). That is why primes are called the building blocks of numbers, and why factorisations are used to find the LCM and GCD and to simplify fractions.
How to check if a number is prime by hand
- Use quick rules first. Even numbers (except 2) are composite; if the digit sum is divisible by 3, so is the number; numbers ending in 0 or 5 are divisible by 5.
- Only test up to the square root. If n = a × b, one of a or b is at most √n. To check 221 you only need primes up to 14: 2, 3, 5, 7, 11 and 13 — and 13 divides it.
- Only test primes. Composite divisors add nothing.
- Watch for look-alikes. 51 (3 × 17), 57 (3 × 19), 91 (7 × 13) and 221 (13 × 17) are often mistaken for primes.
How many primes are there?
Euclid proved more than 2,000 years ago that the primes never run out. They do become rarer: about 1 in 4 numbers below 100 is prime, but only about 1 in 13 below one million. The prime number theorem says the count of primes up to x is roughly x ÷ ln x, which the range mode compares with the true count.
| Up to | Number of primes | Largest prime in range |
|---|---|---|
| 10 | 4 | 7 |
| 100 | 25 | 97 |
| 1,000 | 168 | 997 |
| 10,000 | 1,229 | 9,973 |
| 100,000 | 9,592 | 99,991 |
| 1,000,000 | 78,498 | 999,983 |
Prime Number Checker FAQ
How do I know if a number is prime?
Check whether any prime up to its square root divides it. If none does, it is prime. The prime number checker does this — or a Miller–Rabin test for large numbers — and shows the result with the reasoning.
Is 1 a prime number?
No. A prime must have exactly two different divisors, and 1 has only one. Treating 1 as prime would also break the rule that every number has a single, unique prime factorisation.
What are the prime numbers from 1 to 100?
There are 25: 2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, 59, 61, 67, 71, 73, 79, 83, 89 and 97. Choose “Primes in a range” and enter 1 to 100 to list and copy them.
How large a number can this prime checker handle?
Up to 300 digits. Numbers below 3.3 × 10²⁴ get a proven answer; larger ones get a probabilistic Miller–Rabin answer with an error chance far smaller than a hardware fault. Factorising very large composites can be slow, so a large factor that can’t be split quickly is shown in brackets.
Why are prime numbers important?
They underpin number theory and modern cryptography: RSA encryption relies on the fact that multiplying two large primes is easy, but factoring the product back is extremely hard. Primes also appear in hashing, random number generation and error-correcting codes.
How do I find the prime factorization of 48?
Divide by the smallest prime that fits until you reach 1: 48 ÷ 2 = 24, ÷ 2 = 12, ÷ 2 = 6, ÷ 2 = 3, ÷ 3 = 1. That gives 48 = 2 × 2 × 2 × 2 × 3 = 2⁴ × 3. A tree that starts 6 × 8 reaches the same primes. Type 48 above to see both pictures.
What is a Carmichael number?
A composite number, such as 561 = 3 × 11 × 17, that passes Fermat’s primality test for every base coprime to it. The checker flags them and uses the stronger Miller–Rabin test, which Carmichael numbers cannot fool. You can also explore factorials of primes in the Factorial Calculator.