Prime Number Checker — Is It Prime?

Enter any positive integer to test for primality. The tool also shows the next and previous primes, and the prime factorisation if the number is composite.

Runs in your browser.

What is a prime number?

A prime number is a positive integer greater than 1 whose only divisors are 1 and itself. The first few primes: 2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, 59, 61, 67, 71, 73, 79, 83, 89, 97. There are infinitely many primes (Euclid's theorem) and they form the building blocks of all integers via the fundamental theorem of arithmetic — every integer greater than 1 is either prime or can be uniquely factorised as a product of primes.

Why primes matter

How this checker works

For numbers up to a few billion, the tool uses optimised trial division up to the square root of N. For numbers from a few billion up to JavaScript's safe-integer limit (2^53 − 1), it uses a deterministic Miller-Rabin primality test with witnesses chosen to be correct for all 64-bit integers. The result is exact, not probabilistic.

If the number is composite, the prime factorisation is also computed and displayed.

Tips

FAQs

Is 1 prime?

No — by modern convention, 1 is not prime. It's a "unit" but not a prime.

Is 0 prime?

No — primes are positive integers greater than 1.

What's the largest known prime?

As of 2026, it's a Mersenne prime with over 24 million digits. The Great Internet Mersenne Prime Search (GIMPS) finds new ones.

How fast is this for very large numbers?

Numbers up to 2^53 check in well under a second using Miller-Rabin.

Is anything uploaded?

No.

Related