- Published on
Prime Number Checker: Check If Any Number Is Prime Online
- Authors

- Name
- SpeedDrain
Sponsored

Is 221 a prime number?
Give it a second. It's odd. It doesn't end in 5. The digits add up to 5, so 3 is out. Everything about it looks prime.
It isn't. 221 = 13 × 17.
That's the trap with primes. They're simple to define and surprisingly easy to misjudge by eye. Past two digits your gut stops being reliable, and that's where a prime number checker earns its place. Type a number, and you know right away whether it's prime or composite.
This guide covers both sides. You'll see how to use the free online prime number checker on Speed Drain, and you'll learn the manual methods behind it (divisibility rules, trial division, prime factorization) so you can verify answers on an exam paper or inside your own code. We'll also clear up the usual confusion around 0, 1, negative numbers and the "largest prime."
Quick Answer: How Do You Check If a Number Is Prime?
A number is prime if it is greater than 1 and divisible only by 1 and itself. To test one by hand, divide it by every prime up to its square root. If any division is exact, the number is composite. If none is, it's prime. Or skip the arithmetic and paste the number into the prime number checker.
The manual version in four steps:
- Confirm it's a whole number greater than 1.
- Estimate its square root and round down.
- Try dividing by each prime up to that root: 2, 3, 5, 7, 11, 13 and so on.
- One exact division means composite. No exact division means prime.
What Is a Prime Number?
A prime number is a natural number greater than 1 with exactly two positive divisors: 1 and itself. The first ten primes are 2, 3, 5, 7, 11, 13, 17, 19, 23 and 29.
Take 6. It divides evenly by 1, 2, 3 and 6, so it has four divisors and isn't prime. Numbers like that are called composite.
Two small facts worth memorising. The smallest prime number is 2. And 2 is the only even prime, because every other even number is divisible by 2 and therefore has at least three divisors.
Is 1 a prime number?
No. A prime needs exactly two divisors, and 1 has only one. There's also a deeper reason. If 1 counted as prime, factorization would stop being unique: 12 could be 2 × 2 × 3, or 1 × 2 × 2 × 3, or 1 × 1 × 2 × 2 × 3, forever. Mathematicians settled the definition to keep that from happening. Some older textbooks did treat 1 as prime, which is why you'll still see the odd mention in dusty material.
Is 0 a prime number?
No. Zero isn't greater than 1, and it divides evenly into every non-zero number, so it has infinitely many divisors instead of exactly two. It isn't composite either.
Can a prime number be negative?
In school and college maths, no. Primes are natural numbers above 1. Advanced algebra has a wider idea where −3 can count as a prime element of the integers, but if homework asks "is −7 prime?", the expected answer is no. The checker only accepts positive integers for the same reason.
Prime vs Composite Numbers: What's the Difference?
A composite number has more than two positive divisors, which means it can be written as a product of smaller whole numbers.
| Prime numbers | Composite numbers | |
|---|---|---|
| Positive divisors | Exactly 2 (1 and itself) | 3 or more |
| Examples | 2, 7, 29, 97 | 4, 15, 91, 221 |
| Smallest example | 2 | 4 |
| Even examples | Only 2 | Every even number above 2 |
| Prime factorization | The number itself | Two or more primes multiplied |
The number 1 is neither prime nor composite. And "composite" doesn't mean "big." 4 is composite, while 2,147,483,647 is prime.
How to Use the Prime Number Checker
The Prime Number Checker is a primality test and prime factor calculator in one page. Here's the flow:
- Open the tool.
- Type a positive whole number, or tap one of the presets.
- Read the verdict at the top: prime or composite.
- Scroll down for the factorization, neighbouring primes and divisors.
Here's what it returns, using 180 as the example:
- Verdict: composite, divisible by 2.
- Canonical prime factorization: 2² × 3² × 5.
- Nearest primes: 179 before it, 181 after it.
- Divisor stats: 18 divisors in total (τ) with a sum of 546 (σ).
- Full divisor list: all 18 divisors, with a copy button.
- Twin prime status: a flag for primes that sit two apart, like 11 and 13.
It tests integers up to 2⁵³ − 1, which is 9,007,199,254,740,991. That's a 16-digit number, plenty for homework, coding exercises and most real-world curiosity.
The presets are good teaching examples
| Preset | What it shows | Result |
|---|---|---|
| 180 | A composite with repeated factors | 2² × 3² × 5, 18 divisors |
| 97 | The largest two-digit prime | Prime |
| 8191 | A Mersenne prime (2¹³ − 1) | Prime |
| 65537 | A Fermat prime (2¹⁶ + 1) | Prime |
| 1000000007 | A large prime that programmers use as a modulus | Prime |
| 5040 | A highly composite number (7!) | 2⁴ × 3² × 5 × 7, 60 divisors |
One honest note. The tool gives you the answer and the factors, not a line-by-line classroom working. If your teacher wants steps shown, the next section is your template.
How to Check If a Number Is Prime by Hand
Step 1: Rule out small factors with divisibility tests
These quick rules eliminate most composites before you do any real division.
| Divisor | Rule | Example |
|---|---|---|
| 2 | Last digit is 0, 2, 4, 6 or 8 | 3,486 is even, so not prime |
| 3 | Digit sum is divisible by 3 | 4,521 → 4+5+2+1 = 12, so divisible by 3 |
| 5 | Ends in 0 or 5 | 735 ends in 5 |
| 7 | Double the last digit, subtract it from the rest | 343 → 34 − 6 = 28, which is divisible by 7 |
| 11 | Alternate the signs of the digits and add | 2,728 → 2 − 7 + 2 − 8 = −11, so divisible by 11 |
Step 2: Trial division up to the square root
Why stop at the square root? If n = a × b and a is the smaller factor, then a can't be larger than √n. So if no prime up to √n divides your number, nothing bigger will either.
Example 1: is 97 prime? √97 is about 9.8, so test 2, 3, 5 and 7. It's odd, the digit sum is 16 (not a multiple of 3), it doesn't end in 5, and 7 × 14 = 98 misses by one. No divisor found, so 97 is prime.
Example 2: is 221 prime? √221 is about 14.9, so test 2, 3, 5, 7, 11 and 13. The first five fail. Then 13 × 17 = 221. Composite.
Watch out for 91. It passes the checks for 2, 3, 5 and 11, which tricks a lot of people. It's 7 × 13. Other lookalikes: 51 (3 × 17), 57 (3 × 19), 87 (3 × 29), 119 (7 × 17) and 133 (7 × 19).
Step 3: Use the 6k ± 1 shortcut
Every prime above 3 is either one less or one more than a multiple of 6: 5, 7, 11, 13, 17, 19, 23 and so on. That lets you skip about two thirds of the candidates. It narrows the list but doesn't prove anything on its own, since 25 fits the pattern and is composite.
What's the Fastest Way to Check Prime Numbers?
It depends on the size of the number and what you need back.
| Method | Best for | Speed | Limitation |
|---|---|---|---|
| Divisibility rules | Mental checks on small numbers | Instant | Only rules out small factors |
| Trial division | Numbers up to a few thousand by hand | Slows as √n grows | Impractical for 15+ digits |
| Sieve of Eratosthenes | Listing every prime in a range | Fast for ranges | Memory-hungry for huge ranges |
| Miller-Rabin test | Very large integers | Very fast | Needs correct bases to be exact |
| Online prime checker | Any number up to its cap, with factors | Instant | Capped (2⁵³ − 1 on this tool) |
Why trial division breaks down on big numbers
For a number near 9 × 10¹⁵, the square root is roughly 95 million. Even skipping evens, that's tens of millions of divisions for a single answer. Fine for a computer once, painful in a loop, hopeless by hand.
How the Miller-Rabin test checks large numbers
Miller-Rabin builds on Fermat's little theorem: if p is prime, then a raised to the power p − 1 leaves remainder 1 when divided by p, for any a that isn't a multiple of p. The test sharpens this by also checking square roots of 1, because modulo a prime the only square roots of 1 are 1 and −1. A composite number usually trips over this for at least one base a.
Run enough bases and a composite has nowhere to hide. For every number below 2⁶⁴, a fixed set of bases (the first twelve primes, 2 through 37) is proven sufficient, so the answer is exact rather than "probably prime." The Speed Drain checker uses this deterministic version.
What if the number is even bigger?
Past 2⁵³ − 1, standard browser number types can't store every integer exactly, so capping the input is safer than returning a rounded, unreliable answer. For larger numbers, use mathematical software such as PARI/GP or Python's sympy library. For record-sized numbers, specialised tests are used, such as the Lucas-Lehmer test for Mersenne primes.
Prime Factorization: Breaking a Number Into Primes
Prime factorization means writing a number as a product of primes. The Fundamental Theorem of Arithmetic says every whole number above 1 has exactly one such representation, ignoring the order of the factors.
A factor tree for 180:
- 180 = 2 × 90
- 90 = 2 × 45
- 45 = 3 × 15
- 15 = 3 × 5
So 180 = 2² × 3² × 5.
Once you have the factorization, other things get easy.
Counting divisors. If n = p^a × q^b × r^c, the number of divisors is (a + 1)(b + 1)(c + 1). For 180 that's 3 × 3 × 2 = 18, matching the tool's output. For 5040 (2⁴ × 3² × 5 × 7) it's 5 × 3 × 2 × 2 = 60.
GCD and LCM. Take 180 = 2² × 3² × 5 and 84 = 2² × 3 × 7. The GCD uses the lowest power of each shared prime: 2² × 3 = 12. The LCM uses the highest power of every prime: 2² × 3² × 5 × 7 = 1,260.
Prime Numbers From 1 to 100
There are exactly 25 primes between 1 and 100:
| Range | Primes | Count |
|---|---|---|
| 1–10 | 2, 3, 5, 7 | 4 |
| 11–20 | 11, 13, 17, 19 | 4 |
| 21–30 | 23, 29 | 2 |
| 31–40 | 31, 37 | 2 |
| 41–50 | 41, 43, 47 | 3 |
| 51–60 | 53, 59 | 2 |
| 61–70 | 61, 67 | 2 |
| 71–80 | 71, 73, 79 | 3 |
| 81–90 | 83, 89 | 2 |
| 91–100 | 97 | 1 |
Primes thin out as numbers grow, but slowly. There are 168 below 1,000, 1,229 below 10,000 and 78,498 below one million.
How to find prime numbers in a range
The classic method is the Sieve of Eratosthenes:
- Write out every number from 2 to your limit.
- Circle 2 and cross out all its multiples.
- Circle the next number left standing (3) and cross out its multiples.
- Keep going until you pass the square root of your limit.
- Every circled or uncrossed number is prime.
For 1–100 you only need to sieve with 2, 3, 5 and 7, since 11² = 121 is already over 100.
The checker works one number at a time rather than dumping a range. Its previous-prime and next-prime readout is handy for landing on the closest prime to any number you're working with.
Smallest and Largest Prime Numbers
The smallest prime is 2. There is no largest prime, but there is a largest known one: 2^136,279,841 − 1, a Mersenne prime with 41,024,320 digits, found on October 12, 2024 by the volunteer-run GIMPS project.
How can we be sure there's always a bigger one? Euclid's argument, from around 300 BC, still holds up. Suppose you had a complete list of primes. Multiply them all together and add 1. That new number leaves remainder 1 when divided by every prime on your list, so it's either prime itself or has a prime factor you missed. Either way, your list wasn't complete. There are infinitely many primes.
A number with 41 million digits is far beyond any browser tool, including ours. That's the territory of distributed computing and specialised tests.
Where Prime Numbers Are Actually Used
Primes aren't just classroom material.
- Encryption. RSA multiplies two huge primes, each hundreds of digits long. Multiplying is easy; recovering the two primes from the product is the hard part, and that gap protects secure connections.
- Programming. Hash tables often use prime sizes to spread data evenly, and competitive programmers use 1,000,000,007 as a modulus so often it has its own reputation.
- Everyday maths. Simplifying fractions and finding common denominators both lean on prime factors.
If you write code, a trial-division function with the 6k ± 1 trick looks like this:
def is_prime(n):
if n < 2:
return False
if n < 4:
return True
if n % 2 == 0 or n % 3 == 0:
return False
i = 5
while i * i <= n:
if n % i == 0 or n % (i + 2) == 0:
return False
i += 6
return True
Then cross-check it against the checker. Good edge cases: 0, 1, 2, 4, 9, 25, 49, 91, 561 (a Carmichael number that fools simple Fermat tests) and 2,147,483,647 (prime). Developers who like keeping small utilities close will find more in our roundup of the best web tools for developers.
Online Checker vs Doing It by Hand
| Online checker | By hand | |
|---|---|---|
| Speed | Instant | Slow past 3–4 digits |
| Accuracy | No arithmetic slips | Easy to miss a divisor |
| Extras | Factors, divisors, neighbouring primes | You build them yourself |
| Exams | Not allowed in most | Required |
| Learning value | Good for checking | Best for understanding |
Pros of the online checker: instant answers, free to use, handles 16-digit numbers, and returns factorization and divisors in one go.
Cons: it won't show handwritten working, it's capped at 9,007,199,254,740,991, it checks one number at a time, and you need a connection.
Practical Tips for Students, Teachers and Developers
- Attempt first, check second. Do the problem by hand, then confirm with the tool. That's where the learning happens.
- Memorise the first 25 primes. Everything under 100 becomes instant.
- Trust the square root rule. Testing divisors past √n is wasted effort.
- Use the presets in class. Ask students to predict whether 8191 or 65537 is prime before revealing the answer.
- Test your own functions. Run the edge cases above through the checker before trusting your code.
- Build a study setup that fits. If you're pairing maths with research and note-taking, our guide to the best AI browsers for students and researchers is a useful companion.
Frequently Asked Questions
What is a prime number?
A natural number greater than 1 with exactly two positive divisors: 1 and itself. Examples are 2, 3, 5, 7 and 11.
How do I check if a number is prime?
Divide it by every prime up to its square root. If none divides evenly, it's prime. Or enter it into the prime number checker for an instant answer.
Is 1 a prime number?
No. It has only one divisor, and counting it as prime would break the uniqueness of prime factorization.
Is 2 the only even prime number?
Yes. Every other even number is divisible by 2, so it has at least three divisors.
What is the difference between prime and composite numbers?
Prime numbers have exactly two divisors. Composite numbers have three or more. The number 1 is neither.
How do you find prime numbers quickly?
For one number, use divisibility rules, then trial division up to the square root. For a list, use the Sieve of Eratosthenes.
What are the first 10 prime numbers?
2, 3, 5, 7, 11, 13, 17, 19, 23 and 29.
How do you check large numbers for primality?
Trial division gets too slow, so computers use the Miller-Rabin test. Our checker handles integers up to 9,007,199,254,740,991. Beyond that, use software like PARI/GP or sympy.
What is prime factorization?
Writing a number as a product of primes. For example, 180 = 2² × 3² × 5. Every whole number above 1 has exactly one such form.
Can a prime number be negative?
Not in standard school maths. Primes are natural numbers greater than 1.
What is the easiest way to identify a prime number?
Check for divisibility by 2, 3, 5, 7 and 11 first. If the number survives those, keep testing primes up to its square root.
How does an online prime number checker work?
It runs a primality test, typically trial division for small inputs and Miller-Rabin for large ones. Ours uses a deterministic Miller-Rabin test, so results are exact within its supported range.
Why is 0 not a prime number?
It isn't greater than 1, and it has infinitely many divisors instead of exactly two.
What are the divisibility rules for prime numbers?
Common ones: even last digit for 2, digit sum divisible by 3, ending in 0 or 5 for 5, and the double-and-subtract trick for 7. The full table is in the manual-method section above.
Are there infinitely many prime numbers?
Yes. Euclid proved it over 2,000 years ago, and the argument still stands.
Try It on Your Own Numbers
The next time a number makes you wonder, test it. Open the free prime number checker, try your birth year or your phone number's last four digits, and look at the factors that come back. It's a surprisingly fun way to build a feel for how numbers behave.
If quick calculators are your thing, the tools page also has a percentage calculator and a loan EMI calculator. And for more lightweight utilities worth bookmarking, have a look at our list of underrated web tools.