What is a prime number?
A prime number is a positive integer greater than 1 whose only divisors are 1 and itself. That's the whole definition. 7 is prime because nothing else divides it cleanly. 9 isn't, because 3 divides it. The list starts 2, 3, 5, 7, 11, 13, 17, 19, 23, 29 and keeps going forever — Euclid proved the infinitude around 300 BC with a short, elegant argument that any finite list of primes must be missing at least one.
Primes show up everywhere once you start looking. They're the atoms of arithmetic. Every positive integer above 1 is either prime or a unique product of primes — that's the Fundamental Theorem of Arithmetic. RSA encryption, the math that quietly secures the connection between your browser and your bank, rests on the fact that multiplying two large primes is easy but factoring the result is brutally hard. Most modern internet security inherits that asymmetry.
1 is not prime. This trips people up regularly. The convention exists because prime factorization needs to be unique — if 1 counted, you could write 6 as 2 × 3, or 1 × 2 × 3, or 1 × 1 × 1 × 2 × 3, and uniqueness would die. Excluding 1 keeps the theorem clean. 2 is the only even prime — every other even number has 2 as a divisor, so it can't be prime. After 2, every prime is odd.
How to use the Prime Number Checker
Type any positive integer into the box. The Prime Number Checker tells you immediately whether the number is prime and, if it isn't, shows the divisor that proved it composite. There's no Check button. Your input never leaves your browser — the test runs entirely in JavaScript on your device.
- Enter a positive integer (2 or larger). The tool accepts inputs up to about 1012.
- Read the verdict — Prime or Composite.
- If composite, the smallest non-trivial divisor is shown so you can see why.
- For a full divisor list and prime factorization, jump to the Factor Calculator.
Most prime checkers either bury the answer under sign-up walls, pad the page with ads above the result, or treat "what is a prime number" as a four-screen essay. This page does the check, shows the answer, and gets out of the way.
Trial division — the method behind the check
The simplest way to check whether N is prime is to try dividing it by every integer from 2 up to N - 1. If none divide evenly, it's prime. That works, but it does far more work than necessary. The key shortcut: you only need to test divisors up to √N.
If N has any factor greater than √N, it must also have a paired factor less than √N.
The reason is straightforward. If a × b = N and both a and b were greater than √N, then a × b would be greater than N. Impossible. So any composite number has at least one divisor at or below its square root. Test those, find nothing, and you're done — the number is prime.
That single observation turns a check on a 12-digit number from "test about a trillion candidates" into "test about a million." On modern hardware, that takes under a second. The Prime Number Checker uses this approach, with one extra polish: after testing 2 and 3, it only tries divisors of the form 6k ± 1, because every prime above 3 fits that pattern.
Worked example: is 97 prime?
97 is small enough to walk through by hand. The trial-division procedure:
- Find √97 — it's about 9.85. So we only need to test divisors up to 9.
- Does 2 divide 97? No — 97 is odd.
- Does 3 divide 97? Sum the digits (9 + 7 = 16); 16 isn't divisible by 3, so 97 isn't either.
- Does 5 divide 97? No — it doesn't end in 0 or 5.
- Does 7 divide 97? 7 × 13 = 91, 7 × 14 = 98. So no.
- We've passed √97. Nothing under 9.85 divides 97. 97 is prime.
Notice we never had to test 4, 6, 8, or 9 — if 2 doesn't divide, neither does 4, 6, or 8. If 3 doesn't divide, neither does 9. The Prime Number Checker's inner loop applies the same shortcut automatically.
For comparison, take 91. √91 is about 9.54. Test 2 (no, odd), 3 (no, digits sum to 10), 5 (no), 7 — and 7 × 13 = 91. Found a divisor. 91 is composite. People mistake 91 for prime more often than almost any other small number, because it doesn't look like it has obvious factors. The fix is to actually check 7.
Primes under 100
There are 25 primes below 100. Memorizing the list (or at least the pattern) saves time on math homework, programming interviews, and pub-quiz questions. The Prime Number Checker handles much larger inputs, but this is the conceptual core:
| 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 |
The density of primes thins out as numbers grow — the Prime Number Theorem says the proportion of primes near N drops roughly as 1 / ln(N). Below 100, about 25% are prime. Below 1,000, about 17%. Below 1,000,000, about 7%. Below 1012, about 3.5%. They never run out, but they get rarer.
Special families: Mersenne primes and others
Some primes earn names because they fit a pattern. Mersenne primes are primes of the form 2p - 1 where p itself is prime. The first few: 3 (= 2² - 1), 7 (= 2³ - 1), 31 (= 2⁵ - 1), 127 (= 2⁷ - 1). The largest known prime, as of late 2024, is a Mersenne prime with over 41 million digits — found by the volunteer GIMPS project running on home computers around the world. Mersenne primes are special because there's a fast, efficient test (Lucas–Lehmer) that lets researchers verify them without trial division, which would be hopeless at that scale.
Twin primes are pairs that differ by 2 — (3, 5), (5, 7), (11, 13), (17, 19), (29, 31). Whether infinitely many twin primes exist is still an open problem. Fermat primes have the form 22n + 1. Only five are known (3, 5, 17, 257, 65537), and nobody has found another since 1640. Sophie Germain primes satisfy 2p + 1 also being prime, and matter for cryptographic key generation.
The Prime Number Checker doesn't classify which family a prime belongs to — that's a separate question and most inputs don't fit any named family. But knowing the families exist is useful context for why prime-hunting is a real subfield of math rather than a solved problem.
Common mistakes people make checking primes
If you're stuck on a prime-check problem, the usual culprits:
- Forgetting to test 7. 49, 77, 91, 119, 133, 161 — all small composites with 7 as a factor that look prime if you only test 2, 3, and 5.
- Treating 1 as prime. Old textbooks sometimes did. Modern math doesn't. The fundamental theorem requires excluding 1.
- Stopping too early. If √N is 31.6, you need to test all primes up to 31. Stopping at 29 misses the case where 31 itself is the smallest factor.
- Stopping too late. The flip side. Once you pass √N with no divisor found, the answer is definitively prime. Continuing past √N is wasted work.
- Confusing prime with odd. Most primes are odd, but most odd numbers aren't prime. 9, 15, 21, 25, 27 are odd composites.
If a check looks off, plug the number into the Prime Number Checker and watch which divisor it flags. Seeing 91 = 7 × 13 in print is often enough to recalibrate intuition.
Related tools
The Prime Number Checker is the entry point to a small family of number-theory tools:
- Factor Calculator — lists every divisor of a number plus the prime factorization in exponent form (360 = 2³ × 3² × 5).
- Greatest Common Factor Calculator — finds the GCF of any list of integers via the Euclidean algorithm, with the steps shown.
- Least Common Multiple Calculator — pairs with GCF for fraction arithmetic and scheduling problems.
- Fraction Simplifier — reduces a fraction to lowest terms; uses GCF under the hood.
- Square Root Calculator — useful for working out √N when you're trial-dividing by hand.
Frequently asked questions
Is 0 a prime number?
No. Prime numbers are defined as positive integers greater than 1. 0 isn't positive (and is divisible by every integer, which breaks the "only two divisors" rule). 1 is positive but has only one divisor (itself), so it doesn't qualify either. The Prime Number Checker rejects 0 and 1 with a note rather than silently returning Composite.
Are negative numbers prime?
Not by the standard definition. Primes are positive integers. Some abstract-algebra texts use a generalized notion of "prime element" in a ring that includes negatives (so -2, -3, -5 count there), but for everyday math and for this calculator, primes are positive. Enter a positive number.
Why is 2 the only even prime?
Because every even number greater than 2 has 2 as a factor — so it has at least three divisors (1, 2, and itself). Three divisors disqualifies it from being prime. 2 itself only has 1 and 2 as divisors, which is exactly two, so it qualifies. After 2, the prime sequence is all odd.
How big a number can the Prime Number Checker handle?
About 1012 (one trillion) — that's the practical ceiling for browser-based trial division to finish in under a second. JavaScript numbers max out around 253, so the arithmetic is exact in that range. For genuinely huge numbers — hundreds of digits, the kind RSA uses — trial division stops being viable. Researchers use specialized probabilistic tests like Miller-Rabin, which run fast even for thousand-digit inputs but can occasionally give a false positive (mitigated by running multiple rounds).
What's the difference between checking primality and finding factors?
Primality testing answers a yes/no question — is N prime? Factoring answers a stronger question — what are N's prime divisors? Primality is easier than factoring. There are fast tests (AKS, Miller-Rabin) that prove a number prime in polynomial time without finding any factor. There's no known fast factoring algorithm for general large numbers, which is why RSA still works. For inputs the Prime Number Checker handles, trial division does both in roughly the same time.
What's the largest known prime?
As of late 2024, the record is M82589933 = 282,589,933 - 1, a Mersenne prime with 24,862,048 digits, discovered by GIMPS in 2018. A new larger one (M136279841, ~41 million digits) was announced in October 2024. Records change every few years. Mersenne primes dominate the rankings because Lucas–Lehmer is the only known efficient test fast enough at that scale.
Why do primes matter outside of math class?
Cryptography is the biggest reason. RSA, the algorithm behind a large slice of internet security, generates two large primes (typically 1024 bits each), multiplies them, and uses the product as a public key. Recovering the original primes from the product is the hard problem that protects your data. Primes also show up in hashing, random number generation, error-correcting codes, and the construction of finite fields used in cryptocurrency signatures.
Is there a pattern to where primes appear?
There's no formula that generates only primes. There are patterns — primes thin out logarithmically, primes other than 2 and 3 fit the 6k ± 1 pattern, the Riemann hypothesis describes their large-scale distribution — but no shortcut that lets you list the next prime after a given one without checking. That irregularity is part of why primes are interesting and useful. A perfectly predictable sequence would be useless for cryptography.