Finance 44 tools → Date 19 tools → Health 27 tools → Everyday 23 tools → Math 19 tools → Construction 16 tools → PDF 23 tools → Education 10 tools → Conversion 7 tools → Text 12 tools → Image 8 tools → About → Contact →

Prime Number Checker

Runs entirely in your browser — your numbers are never sent anywhere.

Is it prime?
—

Detail

How the check works

Prime numbers: the atoms of arithmetic

A prime number is a whole number greater than 1 whose only divisors are 1 and itself: 2, 3, 5, 7, 11, 13 and so on. Every other whole number greater than 1 is composite — built by multiplying primes together — and the fundamental theorem of arithmetic guarantees that each composite has exactly one prime factorisation, one recipe, no matter how you break it down. Enter any whole number and this checker tells you whether it is prime, shows that factorisation when it is composite, and finds the nearest primes on either side, the neighbouring atoms in the number line.

The small cases deserve care, because they are where definitions are won and lost. The number 1 is not prime: it has only one divisor, not the required two, and if 1 counted as prime then factorisations would stop being unique, since extra 1s could be sprinkled anywhere. Zero is not prime either — everything divides zero, which is the opposite of having exactly two divisors. And 2 holds a unique distinction as the only even prime, because every other even number has 2 as a proper divisor. Of the numbers from 1 to 100, exactly 25 are prime, and they thin out as numbers grow — but, as Euclid proved over two thousand years ago, they never run out.

How the check works: trial division to the square root

If n = a × b with a ≤ b, then a ≤ √n — so any composite must have a divisor at or below its square root

To test a number, this page divides it by candidate primes up to its square root and stops at the first exact division. The square-root limit is not a shortcut that risks mistakes; it is a proof. Factors come in pairs straddling the square root, so if no divisor exists at or below it, no divisor exists anywhere. Skipping even candidates after 2 and stepping through the pattern around multiples of 6 keeps the test fast: numbers up to ten million resolve instantly, and the factorisation in the results is built by exactly the same divisions, collecting each prime and its exponent.

Reading a factorisation

A composite such as 91 shows its recipe as 7 × 13 — two primes, each to the first power. Powers collect repeats: 72 is 2^3 × 3^2, meaning 2 × 2 × 2 × 3 × 3, written plainly with a caret rather than superscript formatting so it can be copied anywhere. That recipe is immediately useful: it hands you the greatest common factor and lowest common multiple with any other factorised number (by comparing exponents), the count of divisors, and whether the number is a perfect square — it is, exactly when every exponent is even. For a prime, the factorisation is simply the number itself, which the page reports rather than dressing up.

Why primes matter far beyond the classroom

Modern encryption rests on an asymmetry in exactly this page's two operations: multiplying two large primes together is easy, while undoing the multiplication — factorising the result — is, for numbers hundreds of digits long, beyond any known practical method. Every secure purchase and private message leans on that gap. Primes also structure the everyday number system in quieter ways: gear teeth are often chosen as primes so wear patterns distribute evenly, cicadas emerge on prime-numbered year cycles that dodge predators' cycles, and the search for ever-larger primes — currently tens of millions of digits — remains one of mathematics' great public treasure hunts.

Worked example

97 is prime — no number up to its square root (about 9.8) divides it. The previous prime is 89 and the next is 101. By contrast 91 looks prime to many people but is 7 × 13, so it is composite.

How to use this calculator

  1. Enter a whole number — negatives are tested as their positive value.
  2. Read the verdict in the green panel: prime or not prime.
  3. For a composite, read its prime factorisation in the breakdown.
  4. Note the previous and next primes around your number.
  5. Follow the working panel to see why testing up to the square root is enough.

Prime gaps and twin primes

The distance to the neighbouring primes, which this page reports, opens a door onto active mathematics. Primes sometimes arrive in pairs two apart — 89 is followed after 97 by 101 with an unusually wide gap, while pairs such as 11 and 13 or 17 and 19 are called twins — and whether infinitely many twin primes exist is still unproven, though enormous progress was made in the last decade. Gaps between primes grow on average like the natural logarithm of the numbers involved, yet arbitrarily long prime deserts also exist: the factorials provide them, since the run starting just after a factorial is guaranteed composite. Your neighbouring-prime results are a tiny, honest window onto that landscape.

Frequently asked questions

Is 1 a prime number?
No. A prime must have exactly two divisors, 1 and itself, and 1 has only one divisor — itself. Treating 1 as prime would also break the uniqueness of prime factorisation.
Why does the checker only test divisors up to the square root?
Because factors come in pairs around the square root: if a number is composite, one of its factors must be at or below the square root. Finding none there proves the number is prime.
Is 91 prime?
No — 91 is the classic trap. It is not divisible by 2, 3 or 5, which tempts people to stop, but 91 = 7 x 13. Always test up to the square root, which for 91 is about 9.5, so 7 must be tried.
Keep going

Related math calculators