Skip to content
hateitall

Prime Number Checker

Find out if a number is prime, even a huge one, and break it into prime factors.

Processed locallyIn: Whole numberOut: Verdict, Factorization

Loading tool…

How to use prime number checker

  1. Type or paste a whole number, or pick an example.

  2. Read the verdict and the method used to reach it.

  3. For a composite number, wait a moment for the prime factorization.

  4. See the previous and next prime, and copy any result.

What this tool does

  • Deterministic Miller-Rabin, proven exact for every number below 3.3 x 10^24 (all 64-bit numbers and more).
  • Lucas-Lehmer proof for Mersenne numbers 2^p - 1, so 2^127 - 1 is shown as proven prime.
  • Prime factorization by trial division and Pollard's rho, with a time limit so the tab never hangs.
  • Number of divisors and their sum when the factorization is complete.
  • Whole numbers are handled with exact BigInt arithmetic in the browser, so long results are never rounded or cut to 15 or 16 digits the way ordinary calculators do.

How the result is verified

Multiply the prime factors back together to get the original number, and each factor is itself checked for primality. Known cases such as 561 (a Carmichael number) and 2^61 - 1 (a Mersenne prime) give the textbook answers.

Frequently asked questions

Is 1 a prime number?

No. A prime has exactly two different divisors, 1 and itself. 1 has only one, so it is neither prime nor composite. The smallest prime is 2, the only even one.

What does probably prime mean?

For numbers above about 3.3 x 10^24 there is no fixed set of Miller-Rabin tests proven to be exact, so the tool runs 37 rounds. A composite number would have to fool every round, which happens with a chance below 1 in 10^22.

Why is my number not fully factorized?

Finding the factors of a number made of two large primes is very slow, which is what keeps RSA encryption safe. After 4 seconds the tool stops and shows the unfactored part, which it has already proven is composite.

Is my data uploaded to a server?

No. Everything you drop, paste or type is processed by code running in this browser tab. You can check it yourself: open your browser's developer tools, watch the Network panel, and use the tool. No request carries your data.

Greatest common divisor and least common multiple with Euclid's steps

Whole numbers→ NumberLight on device

Exact n!, n!!, nPr and nCr with digit count and trailing zeros

Whole number→ NumberLight on device

a mod n three ways (JS %, Python %, Euclidean) plus modular powers

Number→ NumberLight on device

Binary, octal, decimal, hex and any base 2 to 36, any length

Number→ NumberLight on device