Prime Number Checker – Is It Prime? With Prime Factorization
Type any whole number to see at once whether it is prime. If it is not, you get its prime factorization, how many divisors it has and the nearest primes around it.
A prime number has exactly two divisors: 1 and itself. 97 is prime; 91 is not, because 91 = 7 × 13. 0 and 1 are neither prime nor composite, and 2 is the only even prime.
How to use Prime Number Checker
- Type a whole number.
- Read whether it is prime or composite.
- For composite numbers, see the prime factorization.
- Check the number of divisors.
- Use the next and previous prime if you need a nearby prime.
What is a prime number?
A prime number is a whole number greater than 1 that can only be divided evenly by 1 and by itself. 2, 3, 5, 7, 11 and 13 are primes. A whole number greater than 1 that is not prime is composite: it can be written as a product of smaller numbers, such as 12 = 2 × 2 × 3.
0 and 1 are neither prime nor composite. 1 has only one divisor, and excluding it keeps the prime factorization of every number unique.
Primes up to 100
| Range | Primes |
|---|---|
| 1–20 | 2, 3, 5, 7, 11, 13, 17, 19 |
| 21–40 | 23, 29, 31, 37 |
| 41–60 | 41, 43, 47, 53, 59 |
| 61–80 | 61, 67, 71, 73, 79 |
| 81–100 | 83, 89, 97 |
There are 25 primes below 100.
How to check if a number is prime
You only need to test divisors up to the square root of the number. If 97 had a factor, one of them would be at most √97 ≈ 9.8, so testing 2, 3, 5 and 7 is enough — none divides 97, so it is prime. Quick rules help: even numbers above 2 are not prime, numbers ending in 5 or 0 above 5 are not prime, and if the digit sum is divisible by 3, so is the number.
The checker uses trial division by 2, 3 and numbers of the form 6k ± 1, which is fast enough for any number up to 9,007,199,254,740,991, the largest whole number JavaScript stores exactly.
Prime factorization
Every composite number is a unique product of primes. 360 = 2³ × 3² × 5. From the factorization you can count divisors by adding 1 to each exponent and multiplying: (3 + 1)(2 + 1)(1 + 1) = 24 divisors. Factorizations are also how you find the greatest common factor and least common multiple — the LCM & GCF Calculator calculator does that directly.
Why primes matter
Primes are the building blocks of all whole numbers. Modern encryption, such as RSA, relies on the fact that multiplying two huge primes is easy while factoring the result is extremely hard. The Hash Generator shows another side of cryptography. For other number puzzles, try the Square Root Calculator calculator.
You may also find these free tools useful: GPA Calculator, LCM & GCF Calculator and Slope Calculator.
Frequently asked questions
Is 1 a prime number?
No. A prime needs exactly two different divisors, and 1 has only one. It is neither prime nor composite.
Is 2 a prime number?
Yes. It is the smallest prime and the only even one.
How do I know if a number is prime?
Test whether any prime up to its square root divides it evenly. If none does, the number is prime.
What is prime factorization?
Writing a number as a product of primes, for example 360 = 2³ × 3² × 5. Every composite number has exactly one such factorization.
How many primes are there?
Infinitely many, as Euclid proved more than 2,000 years ago. There are 25 below 100 and 168 below 1,000.
Last updated: