U.UtilityApp
🔢 MathFree · No signup

Prime Number Checker

Check whether a number is prime and see its full prime factorization.

How the check works

The checker uses trial division. It tries dividing your number by 2, 3, 4 and so on, divides out every factor it finds, and stops once the divisor squared is larger than what's left. If nothing divides the number, it's prime. You get a Yes — prime or No — composite verdict plus the full prime factorization, with repeated factors written out.

Stopping at the square root is safe because factors come in pairs. If n = a × b, one of the two is at most √n. For the default, 97, only divisors 2 to 9 need testing, since 10 × 10 = 100 is already past 97. None divides it, so 97 is prime.

Examples, including some that look prime

NumberResultFactorization shown
97Prime97
91Composite7 × 13
221Composite13 × 17
561Composite3 × 11 × 17
1001Composite7 × 11 × 13
360Composite2 × 2 × 2 × 3 × 3 × 5
2147483647Prime2147483647

91 and 221 catch people out because they're odd, don't end in 5, and have digit sums that aren't multiples of 3. The quick rules miss them, and the checker doesn't.

Zero, one, negatives and decimals

  • 0 and 1 are reported as "No — composite" with no factorization. The "No" is right, but the label isn't: neither number is composite. 1 is neither prime nor composite, and 0 is divisible by everything.
  • Negative numbers are checked without the minus sign, so −7 is reported as prime 7.
  • Decimals are rounded to the nearest whole number first, so 7.4 is checked as 7. The heading shows the number actually tested, for example "Is 7 prime?".

Quick tests you can do in your head

  • Ends in 0, 2, 4, 6 or 8: divisible by 2.
  • Digit sum divisible by 3: divisible by 3. For 561, 5 + 6 + 1 = 12.
  • Ends in 0 or 5: divisible by 5.
  • Alternating digit sum divisible by 11: divisible by 11. For 1001, 1 − 0 + 0 − 1 = 0.

Every prime above 3 is one more or one less than a multiple of 6, but the reverse doesn't hold: 91 is 6 × 15 + 1 and still composite. Use these rules to rule numbers out, and the checker to confirm.

The upper limit

To keep the page responsive, trial division stops at divisor 10,000,000. Every number below 100 trillion (10¹⁴) is fully checked, because its square root is under that limit. Above it, a number with no factor below 10 million is reported as prime even when it isn't. For example, 100,000,980,001,501 is 10,000,019 × 10,000,079, yet the checker calls it prime.

Beyond 9,007,199,254,740,992 the browser can't store every whole number exactly, so the number tested may not even be the one you typed. For anything above 100 trillion, use a dedicated math tool.

Frequently asked questions

Why isn't 1 a prime number?+

A prime has exactly two different divisors, 1 and itself, and 1 has only one. Leaving 1 out also keeps factorizations unique: if 1 counted as prime, 6 could be written as 2 × 3, 1 × 2 × 3, 1 × 1 × 2 × 3 and so on.

Is 2 the only even prime?+

Yes. Every other even number is divisible by 2, so it has a divisor besides 1 and itself. That makes 2 the smallest prime and the only even one.

How do I write the factorization with exponents?+

Group the repeated factors. The checker shows 360 as 2 × 2 × 2 × 3 × 3 × 5, which is 2³ × 3² × 5 in exponent form. Multiplying the factors back together should always give your original number.

Embed this tool on your website

Free to use on blogs, school sites and intranets. Paste this code into your page's HTML; please keep the credit line.

<iframe src="https://utilityapp.lat/embed/math/prime-number-checker" title="Prime Number Checker" width="100%" height="660" style="border:0;max-width:760px" loading="lazy"></iframe>
<p style="font-size:13px"><a href="https://utilityapp.lat/math/prime-number-checker">Prime Number Checker</a> by UtilityApp</p>