Prime Number Checker
Check whether a number is prime, and see its prime factorization, divisors, and the nearest previous and next primes.
- Free, no account
- No watermark
- No usage limit
About the Prime Number Checker
"Is 91 prime?" looks like a plain yes or no question. It almost never stops there. The second you learn a number isn't prime, the next question shows up on its own: fine, so what is it actually made of? And if you needed a prime and the one you typed missed, then what's the closest one that works? A lot of online checkers answer the first question and leave you sitting there. This one answers the follow-up before you ask it.
Type any positive whole number and the verdict lands right away, prime or composite, as you type, nothing to click. If it turns out composite the tool keeps going and shows the full prime factorization plus every single divisor. If you were hunting for a prime, it also names the nearest prime below your number and the next one above. So instead of a bare grade you get what the number factors into, every divisor, and the two primes sitting on either side of it. Everything runs in your browser, the number you type never gets sent anywhere, and it keeps working once the page has loaded even with the wifi off. (91, by the way, is 7 times 13. It fools people because it looks prime.)
How to use
- Type a positive whole number into the box. Anything from 2 up to nine trillion works.
- Read the verdict in the highlighted box. It says prime or composite the instant you stop typing, no button to press.
- If the number is composite, look at its prime factorization (written in exponent form, like 2^2 × 3 × 5) and the full divisor list right underneath.
- Check the two neighbors at the bottom: the nearest prime under your number and the next prime above it.
- Change the number whenever. Every result updates on the spot.
Type 0, 1, a negative, or a decimal and the tool explains why that particular value can't be prime instead of throwing an error at you.
When it's not prime, you get the full breakdown
A yes/no tool tells you 60 isn't prime and stops, which is close to the least useful thing it could say. Ours breaks 60 down to 2^2 × 3 × 5, its prime factorization, and then lists all twelve of its divisors: 1, 2, 3, 4, 5, 6, 10, 12, 15, 20, 30, 60. That breakdown is the whole reason to reach for this one over a bare checker.
Those are two different lists and people mix them up all the time. The factorization is only the prime pieces, with a small exponent counting how many times each one appears. The divisor list is every number that divides in evenly, primes and composites alike, which is why 4, 6 and 12 sit in the divisor list but not in the factorization. If you're reducing a fraction, working out a greatest common divisor, or checking whether two numbers share a factor, the divisor list is usually the thing you actually came for. The count shown beside it (twelve, for 60) includes 1 and the number itself. A prime, by definition, has just those two, 1 and itself, and nothing else.
The nearest primes on either side
Say you needed a prime and 100 isn't one. Most tools make you type 101, then 99, then 103, poking around by hand until you hit one. This checker just tells you straight: the prime right below 100 is 97, the next one above is 101.
That neighbor lookup sounds like trivia until you need a prime for an actual reason. Sizing a hash table to a prime number of slots spreads entries out and cuts collisions, so you want the closest prime to your target size. Picking a prime modulus, choosing a prime for a rough pseudo-random generator, building a classroom example, they all begin with "give me a prime near this number." Reading both neighbors off one result beats running the checker over and over. And because primes thin out as numbers get bigger, the gap between the two can be wider than you'd guess, which is worth seeing on its own.
Checking one by hand
You don't need software to test a small number, and it helps to know how, because it's exactly what the tool does fast. The method has a name, trial division, and it is as blunt as it sounds. Try dividing your number by 2, then 3, then each candidate on up. The first one that goes in evenly proves the number composite, and you can stop right there. Get to the end with nothing, it's prime.
The trick that kills almost all the work is that you only have to test up to the square root of the number, nowhere near the number itself. Factors come in pairs that multiply back to your number, so if one factor were bigger than the square root its partner would have to be smaller, and you'd have caught it already. Put 29 through that shortcut and see what happens. The square root is about 5.4, so you only test 2, 3, 4 and 5, none divide in, done, it's prime. The tool runs the same idea with one extra shortcut: it checks 2 and 3, then only the numbers that fall right beside a multiple of six, one above or one below. That skips every multiple of 2 and 3 in a single move, which is how it can settle a number up in the trillions almost instantly.
Frequently asked questions
Why isn't 1 a prime number?
1 has only a single divisor, itself, and a prime needs exactly two. So it doesn't make the cut. It isn't composite either, since a composite number has more than two divisors, which leaves 1 in a group of its own that mathematicians call a unit. There's a practical payoff to keeping it out: if 1 counted as prime you could pad any factorization with extra ones forever (6 = 2 × 3 = 1 × 2 × 3 = 1 × 1 × 2 × 3), and no number would have a single settled factorization anymore. Leaving 1 out is what keeps that breakdown unique, and typing 1 into the tool gets you that explanation.
Why is 2 the only even prime?
Every even number divides by 2. For any even number past 2 that's already a third divisor on top of 1 and itself, which shoves it over the two-divisor limit and makes it composite. 2 slips through because its only divisors are 1 and 2. So it stands alone as the single even prime, and every prime after it is odd. That's a handy thing when you're testing by hand, once you've ruled out 2 you can ignore even divisors completely.
What's the biggest number I can check?
Nine trillion, and that ceiling isn't arbitrary. Testing a number only means trial division up to its square root, and the square root of nine trillion is three million, so even the worst case is about three million quick divisions, which a browser clears in a blink. Set the cap much higher and each check would start to drag, so anything over the limit gets a short note asking for a smaller number instead of a page that grinds. For homework, a teaching example, or settling an argument, nine trillion is far more headroom than you'll touch.
Does my number get sent to a server?
No. The math runs on your device, so the number never leaves the browser and nothing gets logged. Secrecy isn't really the point here, a number you're checking is hardly sensitive. The bigger reason to keep it local is speed. A server tool has to wait on a round trip for every keystroke, which is why so many of them make you press a button first, while running in the browser is what lets the verdict update live as you type. It's the same reason the check still works with the connection off.
Is a negative number ever prime?
No. Primes are defined as greater than 1, so negatives, 0, and 1 are all ruled out from the start. It's a convention, but a useful one, set up so the rules about factorization stay clean. The tool tells you which specific reason applies for each of those inputs instead of lumping them into one vague error.
What does "composite" mean, exactly?
A composite number is any whole number above 1 that isn't prime, meaning it has at least one divisor besides 1 and itself. 4, 6, 9, and 100 are all composite. The tool uses "composite" rather than just "not prime" because it's the precise word, and because a composite number always has a real factorization to show you, which "not prime" on its own wouldn't hint at.