Guides

How to Check if a Number Is Prime (Fast Methods, 2026)

To check if a number is prime, test whether any whole number from 2 up to its square root divides it evenly. If none do, the number is prime; if one does, it is composite. That single shortcut is the heart of every fast primality test you will use by hand.

This guide shows the square-root method, the divisibility shortcuts that let you reject most numbers in seconds, and how to read the result — with worked examples you can reproduce in the Prime Number Checker.

What makes a number prime?

A prime number is a whole number greater than 1 that has exactly two divisors: 1 and itself. 2, 3, 5, 7, 11 and 13 are prime. A composite number has at least one extra divisor — 12 is composite because 2, 3, 4 and 6 all divide it. The numbers 0 and 1 are neither prime nor composite.

The square-root rule

You never need to test divisors beyond √n. If a number n had a factor larger than its square root, that factor would have to pair with one smaller than the square root — which you would already have found. So to check 97, you only test 2, 3, 5 and 7 (since 7² = 49 and 11² = 121 > 97). None divide 97, so 97 is prime.

Divisibility shortcuts

Most non-primes fail one of these instantly:

  • Even? Divisible by 2 (except 2 itself).
  • Digit sum divisible by 3? Then the number is too.
  • Ends in 0 or 5? Divisible by 5.

Only after these do you test 7, 11, 13 and so on up to the square root.

Worked examples

Is 91 prime? It is odd, digit sum 10 (not divisible by 3), does not end in 0/5 — but 7 × 13 = 91, so it is composite. Is 101 prime? Test 2, 3, 5, 7 (7² = 49, next is 11² = 121 > 101): none divide it, so 101 is prime. The Prime Number Checker shows the smallest divisor and the nearest primes for any number.

Common mistakes

The big ones: calling 1 prime (it is not), forgetting that 2 is the only even prime, and testing divisors all the way to n instead of stopping at √n. For deeper study, see the Sieve of Eratosthenes.

Key takeaways
  • A prime has exactly two divisors: 1 and itself.
  • Only test divisors up to the square root.
  • 2 is the only even prime; 0 and 1 are neither prime nor composite.
  • Use divisibility-by-2/3/5 shortcuts to reject most numbers fast.

Prime Number Checker

Instantly test whether any number is prime or composite, with the smallest divisor and nearest primes.

Open the Prime Number Checker

Frequently asked questions

How do you quickly tell if a number is prime?

Test divisibility by 2, 3 and 5 first, then trial-divide by primes up to the square root of the number. If nothing divides it evenly, it is prime.

Is 1 a prime number?

No. A prime must have exactly two divisors. 1 has only one, so it is a unit — neither prime nor composite.

Why only test up to the square root?

Any factor larger than the square root pairs with a smaller factor you would already have found, so testing past √n is unnecessary.

The LCM Calculator Team

Math educators and engineers building free, accurate calculators with step-by-step solutions, visual diagrams and AI insights.