Skip to content
MoneyDeck

Prime Number Checker

Check if a number is prime, factor it, and list primes in any range

Updated · Free, no signup

Range up to 100,000 numbers wide.

Is it prime?

No

Prime factorization

7 × 13

Smallest prime factor

7

Previous prime

89

Next prime

97

Primes in range

25

Primes in range (list)

2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, 59, 61, 67, 71, 73, 79, 83, 89, 97
  • 91 is composite: it is divisible by 7 (91 = 7 × 13).
  • It has 4 divisors in total.

About the Prime Number Checker

This prime number checker tells you whether a whole number is prime — divisible only by 1 and itself — and, if it is not, shows its smallest divisor and full prime factorization. It also finds the nearest primes above and below your number, and lists every prime in a range you choose.

Students use it to check homework on factors and primes, puzzle solvers and programmers use it to test ideas quickly, and teachers use the range list to build worksheets. It handles numbers up to one trillion (10¹²) instantly in your browser.

By definition 0 and 1 are neither prime nor composite, and negative numbers are not prime. The range tool uses a segmented sieve of Eratosthenes and can scan up to 100,000 consecutive numbers at once; the list shows the first 500 primes found.

How to use the prime number checker

  1. 1Enter a whole number to test.
  2. 2Read whether it is prime and, if not, its prime factorization.
  3. 3See the nearest primes below and above it.
  4. 4Set a start and end to list every prime in that range.

Formula and method

n is prime ⇔ n ≥ 2 and no integer d with 2 ≤ d ≤ √n divides n

If n has a factor larger than √n, it must also have a matching factor smaller than √n, so it is enough to test divisors up to the square root. The checker tests 2 and 3, then only numbers of the form 6k ± 1, because every prime above 3 has that form. For n up to 10¹² that is at most about 333,000 trial divisions.

Prime factorization repeatedly divides out the smallest prime factor. The range list uses a segmented sieve of Eratosthenes: it finds all primes up to √(end) and crosses out their multiples inside the range, leaving only the primes.

n
The whole number being tested
d
A candidate divisor
√n
Square root of n — the largest divisor that needs testing

Worked examples

Is 91 prime?

91 looks prime but 91 = 7 × 13. The nearest primes are 89 and 97. There are 25 primes between 1 and 100.

Is 97 prime?

√97 ≈ 9.85, and none of 2, 3, 5 or 7 divides 97, so it is prime — the largest prime below 100.

A large prime: 1,000,000,007

1,000,000,007 is a well-known prime used as a modulus in programming contests. Its neighbours are 999,999,937 and 1,000,000,009. Between 100 and 200 there are 21 primes.

Factoring 600,851,475,143

This 12-digit number (from Project Euler problem 3) factors into four primes, the largest being 6,857.

Powers in a factorization: 360

360 = 8 × 9 × 5 = 2³ × 3² × 5, giving (3 + 1)(2 + 1)(1 + 1) = 24 divisors.

Frequently asked questions

What is a prime number?+

A prime is a whole number greater than 1 whose only positive divisors are 1 and itself. The first primes are 2, 3, 5, 7, 11, 13, 17, 19, 23 and 29.

Is 1 a prime number?+

No. 1 has only one positive divisor, and excluding it keeps the fundamental theorem of arithmetic true: every whole number above 1 has exactly one prime factorization.

Is 2 the only even prime?+

Yes. Every other even number is divisible by 2, so it has at least three divisors (1, 2 and itself) and cannot be prime.

How many primes are there below 100?+

There are 25 primes below 100 and 168 below 1,000. Primes become rarer as numbers grow — roughly 1 in ln(n) numbers near n is prime.

How do I check if a large number is prime by hand?+

Test divisibility by each prime up to the square root of the number. Quick rules help: even numbers and those ending in 5 are out, and if the digit sum is divisible by 3 so is the number.

Related tools