Maaz Zindani

Loading the index…

↑↓ move↵ openesc close3993 pages

Free tool · Math and study

Prime number checker

Type a whole number to see whether it is prime. If it is not, you get its full prime factorization, the number of divisors, the primes either side of it, and a table of the primes in a range you choose.

  • Free
  • No sign-up
  • Runs in your browser

By Maaz Zindani · Updated

A whole number up to 40 digits. 91 is an example: type your own.

The list covers up to 2,000 numbers at a time, starting anywhere.

Prime check

91 is not prime91 = 7 × 13

  • Composite
  • Smallest factor 7
  • 2 above the previous prime
Digits
2
Prime factors
7 × 13
Divisors
4
Distinct primes
2
Previous prime
89
Next prime
97

Check: 7 × 13 = 91.

25 primes from 1 to 100
RangePrimesCount
1–92, 3, 5, 74
10–1911, 13, 17, 194
20–2923, 292
30–3931, 372
40–4941, 43, 473
50–5953, 592
60–6961, 672
70–7971, 73, 793
80–8983, 892
90–99971

How to use the Prime Number Checker

  1. Type the Number to check. Whole numbers up to 40 digits work; commas and spaces are ignored.
  2. Read the verdict, the chips and the cards: the factors of a composite number, or the twin prime and the exact-test note for a prime.
  3. Set List primes from and to to see every prime in that range in a table, up to 2,000 numbers at a time.
  4. Use Copy the result to paste the verdict and factors into your notes.

How do I know if a number is prime?

A prime is a whole number greater than 1 whose only divisors are 1 and itself. To test one by hand, divide it by each prime up to its square root: if none divides it, it is prime. For 91 the square root is just under 10, so you try 2, 3, 5 and 7, and 7 goes in: 91 = 7 × 13, so 91 is not prime even though it looks like it. For 97 none of 2, 3, 5 or 7 divides it, so 97 is prime. There are 25 primes below 100, and the table at the bottom of the page lists them by tens.

The number 1 is not prime, because it has only one divisor, and 0 is not prime either. Two is the only even prime. A number with a unit digit of 0, 2, 4, 5, 6 or 8 is divisible by 2 or 5, which rules out most candidates quickly. Two more quick rules help: a number is divisible by 3 when its digits add up to a multiple of 3, and by 11 when the alternating sum of its digits is a multiple of 11. After those, only the primes up to the square root are left to try, and the checker does that work for you at any size. The checker lists the primes between any two numbers you choose, so you can see how they are spread out.

How does the checker test very large numbers?

Trial division is too slow for a 20-digit number, so the checker uses the Miller-Rabin test, written with whole-number arithmetic so there is no rounding. It runs the test with the first 13 primes (2 to 41) as bases. That set is exact, not a guess, for every number below 3,317,044,064,679,887,385,961,981, about 3.3 × 10²⁴. Above that bound the page uses the first 20 primes as bases and says on the result that the answer is probabilistic: a composite number passing every base is extremely unlikely, but it is not a proof. Do not use this page for cryptographic keys.

Numbers like 561 show why a plain test is not enough. 561 passes the simple Fermat test for every base that shares no factor with it, yet it is composite: 3 × 11 × 17 (the checker reports composite). Miller-Rabin catches it. The same checks run in your browser and nothing you type is sent anywhere.

What are the prime factors of a number, and where is the next prime?

Every whole number above 1 is a product of primes in exactly one way, ignoring order. For a composite number the checker divides out the small primes first and then uses Pollard's rho method to split what is left, so a number like 998,244,359,987,710,471 factors in a blink: 998,244,353 × 1,000,000,007. It also gives the divisor count: add 1 to each exponent and multiply, so 360 = 2³ × 3² × 5 has (3+1)(2+1)(1+1) = 24 divisors. A very large number made of two huge primes cannot be split in the time the page allows, and then it says so: the number is still proven composite, but it is shown as not fully factored.

The primes thin out slowly as numbers grow, and the gap to the next prime is not fixed. The table shows the primes just below and above powers of ten, found with the same test.

The primes either side of powers of ten
NumberPrevious primeNext primeGap between them
1,0009971,00912
1,000,000999,9831,000,00320
1,000,000,000999,999,9371,000,000,00770
1,000,000,000,000999,999,999,9891,000,000,000,03950
1,000,000,000,000,000999,999,999,999,9891,000,000,000,000,03748

Twin primes are pairs two apart, such as 11 and 13; the checker flags them. If you are working on ratios or fractions, the LCM and GCF calculator uses the same prime factors, the fraction calculator reduces fractions by them, and the long division calculator shows how a division with a remainder works out.

Use it with

Questions

How do I know if a number is prime?

Divide it by every prime up to its square root. If none divides it exactly, it is prime. For 97 the primes 2, 3, 5 and 7 all leave a remainder, so 97 is prime.

Is 1 a prime number?

No. A prime has exactly two divisors, 1 and itself, and the number 1 has only one. This keeps the prime factorization of every number unique.

What are the prime factors of a number?

They are the primes that multiply to the number. 360 = 2³ × 3² × 5. Type any number and the checker lists them with their exponents.

What is the next prime after a number?

The checker shows the previous and the next prime for any number you enter. After 97 the next prime is 101; after 1,000,000,000,000 it is 1,000,000,000,039.

How do I test a very large number for primality?

Use Miller-Rabin. With the first 13 primes as bases it is exact below about 3.3 × 10²⁴; above that the result is a strong probable prime, not a proof.

Is 2 the only even prime?

Yes. Every other even number is divisible by 2 and by itself, so it has at least three divisors.

How this page was made: the tool's results are computed in your browser by the code on this page; the explanations were drafted with AI help and checked against the tool's own output.