Every whole number bigger than 1 is either a prime or built entirely out of primes, there’s no third category, which is the whole reason primes get called the atoms of arithmetic.

Free math tool

Prime Number Checker

Prime or not, every factor, the prime factorization, and the nearest primes either side.

Result
Prime factorization
Number of factors
Nearest prime below
Nearest prime above

Runs entirely in your browser using trial division up to the square root of your number. Nothing you enter is sent anywhere.

Why checking up to the square root is enough

Factors of a number always come in pairs that multiply back to it: for 36, that's (1,36), (2,18), (3,12), (4,9), (6,6). Notice the pairs "cross over" right at the square root, 6. Any factor bigger than the square root is always paired with one smaller than it, so if nothing up to the square root divides evenly, nothing larger will either. That's the entire trick behind checking primality quickly.

Prime number checker FAQ

What makes a number prime?

A prime number is a whole number greater than 1 with exactly two factors: 1 and itself. 7 is prime because only 1 and 7 divide it evenly. 8 is not, because 2 and 4 also divide it. 1 itself is not considered prime, by definition it needs exactly two distinct factors, and 1 only has one.

How does this check primality for large numbers?

By trial division: testing whether any whole number up to the square root of your number divides it evenly. If a number has a factor larger than its square root, it must also have a matching factor smaller than the square root, so checking up to the square root is always enough. This makes checking even large numbers fast.

What is the difference between "factors" and "prime factorization"?

Factors are every whole number that divides evenly into yours, 12's factors are 1, 2, 3, 4, 6 and 12. Prime factorization breaks it down into only prime building blocks: 12 = 2² × 3. Every factor of 12 can be built by combining some subset of those prime factors.

Are there infinitely many prime numbers?

Yes, proven by Euclid over two thousand years ago. The proof itself is short: assume there's a largest prime, multiply every prime up to it together and add 1, and that new number is either prime itself or has a prime factor bigger than your supposed largest prime, either way, contradiction.

Is my data private?

Yes. Every calculation runs in your browser. Nothing you enter is sent to a server.

Embed this free tool on your site

Paste this where you want the tool to appear. Please keep the credit link — it is how we keep these tools free.

Free prime number checker by ANUPRESS

The square-root shortcut, explained properly

Checking whether 9,973 is prime by testing every number up to 9,972 would work, but it’s needlessly slow. Factors pair up: for any number n, if a×b = n, one of a or b has to be at most the square root of n, if both were larger than the square root, their product would exceed n. So testing every whole number only up to √n is guaranteed to catch a factor if one exists, that’s the actual algorithm running behind this tool, not a hand-wavy approximation.

Factors versus prime factorization

The full factor list of 60 is 1, 2, 3, 4, 5, 6, 10, 12, 15, 20, 30, 60, every whole number that divides it evenly. The prime factorization is much shorter: 2² × 3 × 5. Every one of those twelve factors can be rebuilt by picking some combination of those prime building blocks, which is why prime factorization is considered the more fundamental description, it’s the smallest set of information that determines everything else about how the number factors.

Primes never run out

It’s tempting to assume primes get rarer and eventually stop as numbers get bigger, and they do get rarer, but they never stop. Euclid proved this over two thousand years ago with an argument that still holds up completely: multiply every prime up to some point together, add 1, and the result either is itself prime or has a prime factor larger than anything on your original list. There’s always a bigger prime waiting.