About the Prime Number Calculator
Prime Number Calculator has four tools in one page. Check whether a number is prime and see the previous and next prime around it. Break a number into its prime factors and count its divisors. List all primes between two numbers, up to 10 million, and copy them. Or find the nth prime, for any n up to one million. The prime test is exact for numbers up to 18 digits, using the Miller-Rabin method with fixed bases, which is proven correct far beyond that size. Factoring works up to 100 trillion, which is 14 digits. Everything is calculated on your device each time you type, and nothing is sent anywhere.
Updated October 2026
How to use the Prime Number Calculator
- 1Choose Is it prime, Prime factors, Primes in a range or Nth prime.
- 2Type the number, or the from and to numbers, or n.
- 3Read the answer, which updates a moment after you stop typing.
- 4Use Previous prime and Next prime to step along the primes.
- 5Copy the factorisation or the list of primes if you need it elsewhere.
What makes a number prime
A prime is a whole number greater than 1 whose only divisors are 1 and itself. Numbers that have other divisors are called composite. The first primes are 2, 3, 5, 7, 11, 13 and 17. Every whole number above 1 is either prime or a product of primes in exactly one way.
Primes matter far beyond the classroom. Modern encryption relies on the fact that multiplying two large primes is easy but splitting the product back into them is very hard.
How this checker works
Small numbers are checked against a list of the first primes. Larger numbers go through the Miller-Rabin test, which looks for evidence that a number is composite using twelve fixed bases. With those bases the answer is certain for every number below 3.3 × 10²⁴, so the tool is exact for all numbers it accepts, up to 18 digits.
If the number is composite and below 100 trillion, the tool also finds its smallest prime factor by trial division and shows how the number splits.
Prime factorization step by step
- Divide by 2 while the number is even.
- Divide by 3, 5, 7 and the following odd numbers while they divide evenly.
- Stop when the divisor squared is more than what is left; anything remaining is prime.
- Write the result with exponents: 360 = 2³ × 3² × 5.
- Add one to each exponent and multiply to count the divisors: (3+1)(2+1)(1+1) = 24.
Listing primes in a range
The range mode uses the sieve of Eratosthenes: it crosses out the multiples of each prime and keeps what is left. The count shown is always exact, while the list is cut to the first 1,000 primes so that the page stays quick. Ranges can end at 10,000,000.
For the numbers themselves rather than their primes, see GCF and LCM Calculator, which uses the same ideas for common factors, and Random Number Generator when you want a number to test. To find common factors use the Fraction Calculator, and the Average Calculator for the mean of a list.
Features
- Prime test for numbers up to 18 digits
- Previous and next prime buttons
- Prime factorisation up to 14 digits, with divisor count
- Primes in a range up to 10,000,000, with the count
- The nth prime for n up to 1,000,000
- Smallest factor shown for composite numbers
- Runs in your browser
Frequently asked questions
Is 1 a prime number?
No. A prime has exactly two different divisors, 1 and itself, and 1 has only one. Treating 1 as prime would also break the rule that every number has one unique prime factorisation. The smallest prime is 2, which is also the only even prime.
How do I check if a number is prime?
Try dividing it by the primes up to its square root. If none divides it evenly, it is prime. For big numbers this is slow, so the calculator uses the Miller-Rabin test, which decides in a moment. Type your number in Is it prime and read the result.
How do I do prime factorization?
Divide by 2 as many times as you can, then by 3, then by the next primes, until what is left is 1. For 360 that gives 2 × 2 × 2 × 3 × 3 × 5, written 2³ × 3² × 5. Enter the number in Prime factors to see it.
What is the largest prime number?
There is no largest prime, because there are infinitely many. The largest one known has tens of millions of digits and was found with special software. This tool tests numbers up to 18 digits, so it cannot check such giants.
How many primes are there below 100?
There are 25 primes below 100, starting with 2, 3, 5, 7, 11 and ending with 97. Try From 1 To 100 in Primes in a range to see them all.
What are twin primes?
Twin primes are two primes that differ by 2, such as 11 and 13 or 41 and 43. Use the Previous prime and Next prime buttons to look for pairs, or list a range and scan for gaps of two.