Prime Number Calculator

Check if any number is prime or composite, get its complete prime factorization, and find primes in any range — instantly.

Last updated: March 2026

Choose whether to test a single number or list primes in a range
Enter any positive integer up to 999,999,999
Is Prime? —
Next Prime —
Previous Prime —

How to Use the Prime Number Calculator

  1. Select a mode — choose "Check a Number" to test one integer, or "Find Primes in Range" to list all primes between two values.
  2. Enter your number(s) — type any positive integer up to 999,999,999 in check mode, or a start and end value (up to 100,000) in range mode.
  3. View instant results — the calculator shows primality, prime factorization, all factors, and the nearest primes above and below your number.
  4. Share results — use the Share button to copy a link with your result pre-loaded.

What This Calculator Shows You

For a single number, the calculator returns: whether the number is prime or composite, the complete prime factorization in exponent notation (e.g., 360 = 2³ × 3² × 5), all factor pairs, the nearest prime number above, and the nearest prime number below. For composite numbers, you'll also see how many factors it has total.

In range mode, the calculator uses the Sieve of Eratosthenes algorithm to efficiently find and list every prime number between your start and end values, along with a count of how many primes exist in that range.

What Are Prime Numbers?

A prime number is a natural number greater than 1 that has no positive divisors other than 1 and itself. Put simply: you cannot divide a prime evenly by any number except 1 and the number itself. For example, 7 is prime because the only numbers that divide it evenly are 1 and 7. In contrast, 9 is not prime (composite) because it equals 3 × 3.

The first 20 prime numbers are: 2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, 59, 61, 67, 71. Notice that 2 is the only even prime — every other even number is divisible by 2 and therefore composite. Primes become increasingly rare as numbers grow larger, though Euclid proved around 300 BCE that they never run out.

A quick primality test: to check whether n is prime, test all integers from 2 up to √n. If none divide evenly into n, then n is prime. This is because if n has a factor greater than √n, it must also have a corresponding factor smaller than √n that you would have already found. Our calculator uses this trial division approach up to √n for fast, accurate results.

The First 100 Prime Numbers

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, 101, 103, 107, 109, 113, 127, 131, 137, 139, 149, 151, 157, 163, 167, 173, 179, 181, 191, 193, 197, 199, 211, 223, 227, 229, 233, 239, 241, 251, 257, 263, 269, 271, 277, 281, 283, 293, 307, 311, 313, 317, 331, 337, 347, 349, 353, 359, 367, 373, 379, 383, 389, 397, 401, 409, 419, 421, 431, 433, 439, 443, 449, 457, 461, 463, 467, 479, 487, 491, 499, 503, 509, 521, 523, 541.

Why Prime Numbers Matter: From History to Cryptography

Prime numbers have fascinated mathematicians for over 2,000 years. Euclid's proof that infinitely many primes exist is one of the oldest proofs in mathematics. The Riemann Hypothesis (1859), one of the Millennium Prize Problems worth $1 million, describes how primes are distributed along the number line and remains unsolved today.

In the modern world, primes power internet security. RSA encryption — the technology protecting your bank account, online shopping, and private messages — works because multiplying two large prime numbers (each hundreds of digits long) is trivial, while factoring the result back into those two primes is computationally infeasible. When you see "https" in your browser, primes are at work behind the scenes.

Prime numbers also appear in nature. Cicadas emerge from the ground in cycles of 13 or 17 years — both prime numbers — which minimizes overlap with predator population cycles. This is an example of evolutionary optimization using mathematical properties discovered long before humans named them.

Prime Number Lookup: Common Questions

Is 2 a prime number?

Yes, 2 is prime — and it is the only even prime number. Every other even number has 2 as a factor, making it composite.

Is 0 a prime number?

No, 0 is not prime. Zero does not meet the definition of a prime because it has infinitely many divisors (every non-zero integer divides 0) and it is not a natural number greater than 1.

Is 97 a prime number?

Yes, 97 is prime. It is not divisible by 2, 3, 5, or 7 (the only primes up to √97 ≈ 9.8), so it passes the primality test. 97 is the 25th prime number.

Is 91 a prime number?

No, 91 is not prime. It equals 7 × 13. This is a classic trick question because 91 looks prime at first glance — it doesn't end in 0, 2, 4, 5, 6, 8, and isn't obviously divisible by 3.

Is 51 a prime number?

No, 51 is composite. 51 = 3 × 17. It's divisible by 3 because 5 + 1 = 6, which is divisible by 3.

Is 1 a prime number?

No, 1 is neither prime nor composite. Mathematicians exclude 1 from the primes because including it would break the Fundamental Theorem of Arithmetic, which states every integer has a unique prime factorization.

What is the largest prime number below 100?

97 is the largest prime below 100. It is the 25th prime. The prime before it is 89, and the first prime above 100 is 101.

Is 999 a prime number?

No, 999 = 3³ × 37. You can confirm this quickly with the divisibility rule for 3: 9 + 9 + 9 = 27, which is divisible by 3, so 999 is not prime.

What are twin primes near 100?

The twin prime pair nearest to 100 is (101, 103). Both are prime, and they differ by exactly 2, satisfying the twin prime definition.

Is 2023 a prime number?

No, 2023 = 7 × 17². It is composite. You would find this by dividing: 2023 ÷ 7 = 289, and 289 = 17².

People Also Search For

How to find if a number is prime without a calculator

To manually test primality, divide the number by every prime up to its square root. For example, to test 143: √143 ≈ 12, so test primes 2, 3, 5, 7, 11. You'll find 143 ÷ 11 = 13, so 143 = 11 × 13 — composite. If none divide evenly, the number is prime.

What is prime factorization and how do I find it?

Prime factorization breaks a number into its prime building blocks. Start by dividing by the smallest prime (2) repeatedly, then move to 3, 5, 7, etc. For 360: 360 ÷ 2 = 180, ÷ 2 = 90, ÷ 2 = 45, ÷ 3 = 15, ÷ 3 = 5, ÷ 5 = 1. So 360 = 2³ × 3² × 5.

How many prime numbers are between 1 and 1000?

There are 168 prime numbers between 1 and 1000. The Prime Number Theorem approximates the count of primes up to n as n ÷ ln(n); for n = 1000, that estimates about 145 — the actual count of 168 shows primes are slightly more frequent at smaller scales.

What is the difference between prime and composite numbers?

A prime has exactly two factors (1 and itself); a composite has three or more factors. The number 1 is special — it has only one factor and is classified as neither prime nor composite. Every composite number can be written uniquely as a product of primes (Fundamental Theorem of Arithmetic).

What is a prime number checker algorithm?

The fastest simple algorithm is trial division up to √n. For very large numbers, probabilistic tests like Miller-Rabin are used — these run in polynomial time and are used in production cryptographic systems. Our calculator uses trial division, which is exact and fast for numbers up to ~10⁹.

Can negative numbers be prime?

By convention, no — primes are defined only among positive integers greater than 1. In some abstract algebra contexts (ring theory), the concept extends to negative numbers differently, but in standard arithmetic, prime numbers are always positive.

Frequently Asked Questions

Is 1 a prime number?

No. By definition, prime numbers must have exactly two distinct divisors: 1 and themselves. The number 1 has only one divisor, so it is classified as neither prime nor composite.

What is the smallest prime number?

2 is the smallest prime number, and the only even prime. Every even number greater than 2 is divisible by 2 and therefore composite.

How does the calculator test primality?

The calculator uses trial division, testing whether the number is divisible by any integer from 2 up to its square root. If no divisor is found, the number is prime. This approach is exact and runs in the browser with no data sent to any server.

What are twin primes?

Twin primes are pairs of primes that differ by 2, such as (3,5), (11,13), (17,19), and (29,31). The Twin Prime Conjecture posits that infinitely many such pairs exist, but this remains one of mathematics' great open problems.

What is the Sieve of Eratosthenes?

An ancient algorithm (c. 240 BCE) that finds all primes up to N by marking multiples of each prime starting from 2 as composite. It's the method used by this calculator's Range mode and remains one of the most efficient ways to generate primes in bulk.

What is prime factorization used for?

Prime factorization is used to find the GCF and LCM of numbers, simplify fractions, solve equations, and underpin RSA encryption. Every positive integer greater than 1 has exactly one unique prime factorization (Fundamental Theorem of Arithmetic).

Are there infinitely many prime numbers?

Yes. Euclid proved this around 300 BCE: assume a finite list of all primes, multiply them together and add 1 — the result is either prime itself or has a prime factor not on the list. Either way, the list was incomplete. Therefore infinitely many primes exist.

What is a Mersenne prime?

A Mersenne prime has the form 2ⁿ − 1. Known Mersenne primes include 3 (2²−1), 7 (2³−1), 31 (2⁵−1), and 127 (2⁷−1). The largest known primes are Mersenne primes, searched by the GIMPS distributed computing project.

How are prime numbers used in cryptography?

RSA encryption relies on the product of two large primes. Multiplying 300-digit primes is fast; factoring their product is computationally infeasible with current technology, taking longer than the age of the universe. This asymmetry secures internet communications.

Is my data saved when I use this calculator?

No. All calculations run entirely in your browser using JavaScript. No numbers you enter are transmitted to any server. Your data never leaves your device.

What is the largest number this calculator can check?

The primality checker handles numbers up to 999,999,999 (just under 1 billion). For range mode, both values must be within 1–100,000 to keep results manageable. Numbers beyond these limits should be tested with specialist tools.