Skip to content
NumberCalculator365

Prime Number Checker

How to Check a Prime Number

Published 2026-11-03

Prime number checker is a million-search-a-month query because the definition is short and the mistakes are famous: 1 is not prime, 2 is, 91 looks prime until 7 × 13. A prime has exactly two positive divisors, 1 and itself.

Use the free tool

Run these formulas with your own numbers. Math stays in your browser.

Open Prime Number Checker →

Our prime number checker tests one whole number up to 1e12 by trial division. If the number is composite it shows the smallest factor greater than 1. It does not list primes in a range or generate keys. For every divisor, use the factor calculator.

Open the prime number checker

Enter an integer. 97 should read Prime. 91 should read Not prime with factor 7. 0 and 1 read not prime.

The square-root test

You never need a factor larger than √n. If n is even and greater than 2, stop. Then try 3, 5, 7… until the square root. That is the method the tool uses.

n is prime ⇔ n > 1 and no d with 1 < d ≤ √n divides n

Worked checks

√97 ≈ 9.8, so testing 2, 3, 5, 7 is enough. √91 ≈ 9.5, and 7 divides 91.

Prime or not
nPrime?Note
1NoOnly one divisor
2YesOnly even prime
97YesDefault on the tool
91No7 × 13
121No11²

Prime checker versus factor calculator

The checker stops at the first factor. The factor calculator lists every divisor and writes n as p^a × q^b. Factorial n! is unrelated — that lives on the scientific calculator.

  1. Reject 0 and 1.
  2. Test 2, then odd integers through √n.
  3. If none divide n, it is prime.
  4. If you need the full factor list, switch tools.

Traps: 1, 91 and squares

1 fails the two-divisor rule, so the prime number checker labels it not prime before any trial division. 91 looks prime (odd, not a multiple of 5) until 7×13. 121 is 11² — you only need to test through √121 = 11. Even numbers greater than 2 are finished on the first step: the smallest factor is 2. That is the entire product people want from “prime number checker”: yes or no, and a factor when the answer is no. Generating a list from 1 to 100, proving a 300-digit probable prime, or writing n! are different jobs. The factor calculator then writes the unique prime factorization the fundamental theorem promises for every n > 1.

Use the free tool

Run these formulas with your own numbers. Math stays in your browser.

Open Prime Number Checker →

Frequently Asked Questions

Is 1 prime?

No. Exactly two divisors are required.

Is 2 prime?

Yes.

Does this list primes from 1 to 100?

No. One integer per check.

Are negatives prime?

Not on this page. Inputs are whole numbers ≥ 0.

Is this cryptography?

No. Trial division through 1e12, not a primality certificate.

Related calculators

More guides