Prime Number Checker
Check whether any number up to 20 digits is prime, and see the nearest primes on both sides — plus the prime factors and divisors when it is not. Free, instant and private: all tests run in your browser.
Whole numbers up to 20 digits. Commas and spaces are ignored, so you can paste 1,000,003.
Prime factorization
Divisors
How to use the prime number checker
- Type a number. Enter any whole number up to 20 digits — commas and spaces are stripped automatically, so pasted values like 1,000,003 work fine.
- Read the verdict. The tool instantly tells you whether the number is prime, along with the closest prime below and above it.
- Inspect composites. If the number is not prime you also get its smallest prime factor, its full prime factorization and a list of its divisors.
About this tool
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. This free prime checker uses the deterministic Miller–Rabin primality test with a fixed set of witnesses, which is mathematically proven to give the exact answer (not a probabilistic guess) for every number below 1024. That makes checking even a 20-digit number instantaneous. Composite numbers are then factored with trial division and Pollard's rho algorithm so you can see exactly why they fail the test — or jump to the dedicated prime factorization tool for more detail.
Prime checks are useful for number-theory homework, cryptography experiments, hash-table sizing and puzzle solving. Everything runs locally in your browser with exact big-integer arithmetic: the numbers you test are never uploaded, stored or logged.
Frequently asked questions
How does the checker know a number is prime?
It uses the Miller–Rabin primality test with the witness set 2, 3, 5, 7, …, 37. With these specific witnesses the test is proven deterministic for all numbers below about 3.3 × 1024, so within this tool's 20-digit limit the verdict is always exact — never a probability.
Why is 1 not a prime number?
A prime must have exactly two distinct divisors: 1 and itself. The number 1 has only one divisor, so it is neither prime nor composite. Excluding 1 also keeps the fundamental theorem of arithmetic true: every number has exactly one prime factorization.
Can negative numbers or 0 be prime?
No. Primes are defined over the natural numbers greater than 1. Zero is divisible by every integer, and negative numbers are excluded by definition — although if you enter −7 the tool will point out that its absolute value 7 is prime.
What are the "previous prime" and "next prime" values?
They are the closest primes strictly below and above your number, found by testing neighbouring candidates with the same deterministic test. Prime gaps near 1020 average only around 46, so the search is instant.