By · Updated

Prime Number Checker

Is It Prime? Check Any Number or List Primes in a Range

No ratings yet
Result

—

OneTask is free, with no sign-up, and built by one person.
If this tool saved you time, a coffee helps keep new ones coming.

How the Prime Number Checker works

This prime number checker tells you whether any whole number is prime, even numbers with dozens of digits. When it is not prime, it shows the smallest factor and the matching split. It also finds the previous and next prime, and in range mode it lists every prime between two numbers up to 100,000 apart.

A prime number has exactly two factors, 1 and itself, so 2, 3, 5, 7 and 11 are prime while 9 = 3 × 3 is not. Every whole number above 1 is either prime or a product of primes, which makes primes the building blocks of arithmetic. Large primes also keep online banking safe, because multiplying two big primes is easy while splitting the product back apart is extremely slow.

How the prime number checker works

The formula for small numbers is trial division by primes up to the square root, since any factor above √n pairs with one below it. For large numbers the checker runs the Miller-Rabin test with a fixed set of bases, which is exact for every number below 3.3 × 10²⁴ and overwhelmingly reliable beyond. Ranges are found with a sieve.

First example. 97 is prime: √97 is under 10, and 97 is not divisible by 2, 3, 5 or 7.

Second example. 91 is not prime. Its smallest factor is 7, because 91 = 7 × 13, a classic number that looks prime but is not.

How many primes are below 100? There are 25, from 2 up to 97. Below 1,000 there are 168.

The first 25 prime numbers and the gaps between them

# Prime Gap from previous
1 2 –
2 3 1
3 5 2
4 7 2
5 11 4
6 13 2
7 17 4
8 19 2
9 23 4
10 29 6
11 31 2
12 37 6
13 41 4
14 43 2
15 47 4
16 53 6
17 59 6
18 61 2
19 67 6
20 71 4
21 73 2
22 79 6
23 83 4
24 89 6
25 97 8

Tips and pitfalls

FAQ

How do you check if a number is prime?

Divide it by each prime up to its square root. If none divides exactly, it is prime. To test 113, check 2, 3, 5 and 7, since √113 is about 10.6; none work, so 113 is prime. The checker uses faster tests for very large numbers.

Is 1 a prime number?

No. A prime must have exactly two different factors, and 1 has only one. Treating 1 as prime would also break the rule that every number has a single prime factorisation, since 6 could be 2 × 3 or 1 × 2 × 3. So 1 is neither prime nor composite.

What are the prime numbers from 1 to 100?

There are 25: 2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, 59, 61, 67, 71, 73, 79, 83, 89 and 97. Choose List primes in a range, enter 1 and 100, and the checker lists them for you.

What is the largest known prime number?

The record holders are Mersenne primes of the form 2^p − 1, found by the GIMPS distributed computing project. They run to tens of millions of digits. There is no largest prime overall: Euclid proved more than 2,000 years ago that the primes never run out.

What is a composite number?

A composite number is a whole number above 1 that has more than two factors, so it can be split into smaller whole numbers multiplied together. 12 is composite because 12 = 3 × 4. Every whole number above 1 is either prime or composite.

See also: all Number Theory tools, Arithmetic, Algebra and Geometry, Statistics, Trigonometry and Calculus.

Related tools