📐 Math & Science

Is It a Prime Number?

Check whether a number is prime and find the primes around it.

  • Is it prime?instant check
  • Next · previousnearest primes
  • Smallest factorfor composites
  • Range listsieve up to 100,000

—

Previous prime—
Next prime—
Smallest factor—

    How to use the Prime Number Checker

    1. 1

      Enter a whole number

      Any non-negative integer.

    2. 2

      Read the verdict

      Prime, composite, or neither (for 0 and 1).

    3. 3

      See the neighbours

      The previous and next primes and the smallest factor.

    4. 4

      List a range

      Enter “from” and “to” to see every prime in between, with a count.

    Features

    Instant primality test

    Works for very large numbers too.

    Neighbouring primes

    Previous and next prime.

    Smallest factor

    Proof that a composite number is not prime.

    Prime lists

    Every prime in a range, from a sieve.

    Prime count

    How many primes the range contains.

    Private

    Nothing leaves your device.

    Who uses it — and for what

    Maths classes

    Factor trees, HCF/LCM and number puzzles.

    Programming

    Test cases for prime-checking code.

    Cryptography learning

    Why RSA relies on large primes.

    Puzzles and quizzes

    Check prime-related answers.

    What makes a number prime

    A prime number has exactly two divisors: 1 and itself. The first primes are 2, 3, 5, 7, 11, 13, 17, 19, 23 and 29; 2 is the only even prime. Numbers with more divisors are composite (e.g. 21 = 3 × 7), and 0 and 1 are neither. To check small numbers you only need to test divisors up to the square root; for large numbers the checker uses the deterministic Miller–Rabin test with big-integer arithmetic, which is exact for every number below 3.3 × 10²⁴.

    Primes in a range

    The list below uses the Sieve of Eratosthenes to show every prime between two numbers (up to a span of 100,000), with a count. There are 25 primes below 100, 168 below 1,000 and 1,229 below 10,000. Primes get rarer as numbers grow, but there are infinitely many — Euclid proved it around 300 BC. They are the foundation of modern encryption such as RSA, which relies on how hard it is to factor the product of two huge primes.

    Every result is calculated in your browser the moment you type, so you can change a number and see the effect instantly — ideal for checking homework, worksheets and exam practice. Results are shown to a sensible number of decimal places; very large or tiny values switch to scientific notation.

    Quick divisibility tests

    Divisible byTest
    2Last digit is even
    3Sum of digits divisible by 3
    5Last digit 0 or 5
    7Double the last digit and subtract from the rest; repeat
    11Alternating sum of digits divisible by 11
    13Add 4× the last digit to the rest; repeat

    To check a number by hand you only need to try primes up to its square root: for 391 that means trying primes up to 19, and 391 = 17 × 23.

    Famous prime patterns

    • Twin primes differ by 2: (11, 13), (17, 19), (101, 103). Nobody has proved there are infinitely many.
    • Goldbach’s conjecture: every even number above 2 is the sum of two primes (28 = 5 + 23 = 11 + 17). Checked far beyond 10¹⁸ but still unproven.
    • Mersenne primes have the form 2ⁿ − 1. The largest known primes are Mersenne primes with tens of millions of digits.
    • Every prime above 3 is one more or one less than a multiple of 6.

    Primes and your online security

    When you see the padlock in a browser, public-key cryptography is at work. RSA keys are built from two very large primes multiplied together. Multiplying them is instant, but recovering the two primes from the product is practically impossible for numbers hundreds of digits long — that one-way difficulty keeps the key safe. Modern systems also use elliptic-curve cryptography, which works over fields defined by a large prime.

    Worked examples

    97

    Prime. The previous prime is 89, the next is 101 — 97 is the largest prime below 100.

    91

    Not prime — 91 = 7 × 13. It looks prime because it is odd, not divisible by 3 or 5, and does not end in an even digit.

    561

    Not prime — 561 = 3 × 11 × 17. It is the smallest Carmichael number, which fools some simple primality tests.

    2,147,483,647

    Prime — it is 2³¹ − 1, a Mersenne prime, and the largest value of a signed 32-bit integer in programming.

    Pro tips

    • Any even number other than 2 is composite — no need to check further.
    • A number ending in 5 (other than 5 itself) is never prime.
    • Use the Prime Factorization Calculator to see the full factor breakdown.

    Glossary

    Prime number
    A whole number above 1 with exactly two divisors, 1 and itself.
    Composite number
    A whole number above 1 with more than two divisors.
    Sieve of Eratosthenes
    An ancient method for listing primes by crossing out multiples.
    Mersenne prime
    A prime of the form 2ⁿ − 1.

    Frequently asked questions

    Is 1 a prime number?

    No.

    Is 2027 a prime number?

    Yes, 2027 is prime.

    How many primes are there below 100?

    25.

    Is 0 prime?

    No — 0 is divisible by every positive number.

    What is the smallest prime number?

    2, the only even prime.

    How many primes are there below 1,000?

    168.

    Found it useful? Share the Prime Number Checker:

    Last updated 2026-11-21 · Built by Vinayak Agarwal · Part of Math & Science (42 tools)