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.
What you enter stays on your device while you use this tool. Opening a shared link sends the settings in its address to HowToolbox to prepare the page.
A whole number of up to 100 digits
Is it prime?
Not prime
24 is a composite number: it has divisors other than 1 and itself.
About this number
- Certainty
- Proven
- Next prime
- 101
- Previous prime
- 89
Test any whole number up to 100 digits for primality, with its prime factors and the next and previous prime.
How to use
- Type a whole number. Spaces or commas between groups of digits are fine.
- Read whether it is prime, how sure the answer is, and its prime factors, next prime and previous prime.
- Copy any value, or copy the link to share the same number.
Prime factors of common numbers
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.
Sources
- OEIS: A014233 (smallest odd composite that is a strong pseudoprime to the first n prime bases)Used for: limits and cut-offs
- Wikipedia: Miller–Rabin primality testUsed for: rules
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.
Next you might need
More in Math & numbers
- Percentage calculator, private, runs on your device
- Area of shapes, private, runs on your device
- Confidence interval calculator, private, runs on your device
- Correlation and regression calculator, private, runs on your device
- Descriptive statistics calculator, private, runs on your device
- Factorial, private, runs on your device





