Skip to content

Prime number checker

Math & numbers

Is your number a prime number?

Test any whole number up to 100 digits for primality, with its prime factors and the next and previous prime.

A whole number of up to 100 digits

Is it prime?

Not prime

360 is a composite number: it has divisors other than 1 and itself.

About this number

Certainty
Proven
Next prime
101
Previous prime
89

Sponsored Links

Test any whole number up to 100 digits for primality, with its prime factors and the next and previous prime.

How to use

  1. Type a whole number. Spaces or commas between groups of digits are fine.
  2. Read whether it is prime, how sure the answer is, and its prime factors, next prime and previous prime.
  3. Copy any value, or copy the link to share the same number.

Prime factors of common numbers

NumberPrime factors
122 × 2 × 3
242 × 2 × 2 × 3
602 × 2 × 3 × 5
1002 × 2 × 5 × 5
3602 × 2 × 2 × 3 × 3 × 5

How it works

A prime number is a whole number above 1 whose only divisors are 1 and itself: 2, 3, 5, 7, 11 and so on. Every other number above 1 is composite and is a product of primes in exactly one way, apart from the order: 1200 = 2⁴ × 3 × 5². The numbers 0 and 1 are neither prime nor composite.

Dividing by every possible factor is far too slow for big numbers, so the check uses the Miller–Rabin test. It takes a base a and looks for a pattern in the powers of a that every prime must follow; a composite number usually breaks the pattern, and the base that breaks it is a witness. Below about 3.3 × 10²⁴ a fixed set of the first 13 primes as bases is known to catch every composite, so “prime” there is a proof. Above that, no fixed set is proven, so a number that passes 20 bases is shown as “probably prime”: certain enough for practice, but not a proof. “Not prime” is always a proof.

Prime factors are found by trial division, which is instant up to 10¹⁵ (a thousand trillion). Above that a composite number is recognised as composite but not factored here. That gap is no accident: testing whether a number is prime is much easier than finding its factors, and much of modern encryption relies on it.

Sponsored Links

Frequently asked questions

Is 1 a prime number?

No. A prime has exactly two divisors, and 1 has only one. Treating 1 as prime would also break the rule that every number has a single prime factorisation.

Is 2 the only even prime?

Yes. Every other even number is divisible by 2, so it has a divisor besides 1 and itself.

What does “probably prime” mean?

The number passed 20 Miller–Rabin tests with different bases. No composite number is known that fools them all, but for numbers this large it has not been proven, so the page does not call it proven.

How many primes are there?

Infinitely many, as Euclid showed over two thousand years ago. They thin out as numbers grow, but there is always a next one.

Why are no prime factors shown for a large composite number?

This tool factors numbers only up to 10¹⁵. Above that limit it can still identify a composite number without finding its factors.

Sponsored Links

Sponsored Links