Prime Number Checker

A prime number is a whole number greater than 1 whose only positive factors are 1 and itself. Enter any whole number up to one trillion to see whether it is prime. If it is not, you get its prime factorization and smallest factor. You also get the nearest primes on each side.

How to use the prime number checker

  1. Enter a whole number from 0 to 1,000,000,000,000.
  2. Read whether it is prime, composite, or neither (0 and 1).
  3. For composite numbers, the factorization shows the primes that multiply to make it.

Formula

The checker uses trial division: a number n is prime if no integer from 2 up to √n divides it. Only checking up to √n is enough because any larger factor would pair with a smaller one you have already tested.

Worked examples

A prime

97 is prime: it is not divisible by 2, 3, 5 or 7 (the primes up to √97 ≈ 9.8). The next prime is 101 and the previous is 89.

A composite

91 looks prime but 91 = 7 × 13. The smallest factor, 7, is found quickly because 7 × 13 = 91.

A larger prime

1,000,003 is prime. The next prime after it is 1,000,033 and the one before it is 999,983.

Why prime numbers matter

Every whole number greater than 1 is either prime or a unique product of primes. This is the Fundamental Theorem of Arithmetic, and it makes primes the atoms of number theory.

The first primes

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. There are 25 primes below 100 and 168 below 1,000.

Divisibility shortcuts

Divisible byTest
2Last digit is even
3Digit sum divisible by 3
5Last digit is 0 or 5
9Digit sum divisible by 9
11Alternating digit sum divisible by 11

Where primes are used

Modern encryption, such as the RSA method used to protect online payments, relies on the fact that multiplying two large primes is easy but factoring the product is extremely hard. Primes also appear in hashing, random number generation and even in the life cycles of some cicadas.

Twin primes and gaps

Pairs of primes that differ by 2, such as 11 and 13 or 41 and 43, are called twin primes. As numbers grow, primes become rarer on average, yet the gaps are irregular, which you can see by comparing the next and previous prime this tool reports.

Practice problems

Try these yourself first, then check your answer. The answers come from the calculator above.

  1. Is 221 prime?
    Show answer

    Is 221 prime?: No, composite

  2. Is 541 prime?
    Show answer

    Is 541 prime?: Yes, prime

Common mistakes to avoid

  • Treating 1 as prime. It has only one factor, so it is neither prime nor composite.
  • Assuming odd numbers are prime. 9, 15, 21 and 91 are odd but composite.
  • Forgetting 2 is prime. It is the only even prime.

Frequently asked questions

Is 1 a prime number?

No. A prime has exactly two distinct factors, and 1 has only one.

Why is 2 the only even prime?

Every other even number is divisible by 2, so it has at least three factors.

How can I quickly spot multiples of 3?

Add the digits. If the sum is divisible by 3, so is the number: 91 gives 10, which is not, but 93 gives 12, which is.

Are there infinitely many primes?

Yes. Euclid proved this more than 2,000 years ago.

Reviewed September 26, 2026 by the SolveCalcPro editorial team. Found a mistake? Tell us; see our editorial policy.