About the Prime Number Checker
Some numbers look prime but are not: 91, for example, equals 7 × 13. This prime number checker settles the question instantly for any whole number, showing the smallest prime factor and full factorization when the number is composite. It also finds the nearest primes above and below and lists every prime in a range, which helps with homework and puzzles.
Small numbers are checked by trial division. Large numbers, up to hundreds of digits, are tested with the Miller–Rabin primality test using the first twelve prime bases, which is proven to give the correct answer for every number below 3.3 × 10²⁴ and is overwhelmingly reliable beyond that. Composite numbers are split with trial division and Pollard's rho method, all with exact BigInt arithmetic in your browser.
Example: 97 is prime; the previous prime is 89 and the next is 101. 91 looks prime but is 7 × 13. 2,147,483,647 (2³¹ − 1), the largest 32-bit signed integer, is a famous Mersenne prime. Between 1 and 100 there are 25 primes, the first being 2, the only even prime.
There are infinitely many primes, as Euclid proved over 2,000 years ago, and they underpin modern encryption. Break composite numbers into primes with the prime factorization calculator, find common factors with the GCF calculator, and explore remainders with the modulo calculator.
How to use the Prime Number Checker
- Enter a numberType any whole number; very large numbers are fine.
- Read the verdictSee whether it is prime, and its smallest factor if it is not.
- Find nearby primesSee the previous and next prime numbers.
- List primes in a rangeEnter a start and end to list every prime between them (up to a 100,000-number range).
Prime Number Checker features
- Instant prime or composite verdict
- Smallest prime factor and full factorization
- Next and previous prime numbers
- List of primes in a range
- Deterministic Miller–Rabin test for huge numbers
- Exact BigInt arithmetic
- Runs entirely in your browser
Common uses
- Checking math homework on primes and factors
- Finding primes for programming exercises
- Exploring number patterns and puzzles
- Picking primes for hashing or simple cryptography lessons
- Teaching divisibility
Prime numbers explained: testing, patterns, records and why they protect your data
A prime number has exactly two divisors, 1 and itself. Primes are the building blocks of all whole numbers, and they matter far beyond school maths: they underpin the encryption that secures online banking and shopping. This guide explains how to test whether a number is prime by hand, quick divisibility checks, how primes thin out among larger numbers, record-breaking primes and why 1 is not counted as prime.
Testing by trial division
To test whether a number is prime, try dividing it by the primes up to its square root. If none divides it exactly, it is prime. There is no need to go further, because any factor larger than the square root would pair with one smaller than it.
For 221, the square root is about 14.9, so test 2, 3, 5, 7, 11 and 13. The number 13 divides it: 221 = 13 × 17, so 221 is not prime. For 223, none of those primes divides it, so 223 is prime.
Quick divisibility checks
- 2: the last digit is even.
- 3: the sum of the digits is divisible by 3.
- 5: the last digit is 0 or 5.
- 11: the alternating sum of the digits is divisible by 11, as in 1,331, where 1 − 3 + 3 − 1 = 0.
These checks rule out many numbers instantly, leaving only a few divisions to test by hand.
A worked example: is 391 prime?
The square root of 391 is about 19.8, so the primes to test are 2, 3, 5, 7, 11, 13, 17 and 19. It is odd, its digits sum to 13, so it is not divisible by 3, and it does not end in 0 or 5. Testing 7, 11 and 13 leaves remainders, but 17 divides it: 391 = 17 × 23.
Numbers like 391, the product of two primes close together, look prime at first glance, which is why systematic testing matters.
The sieve of Eratosthenes
The ancient Greek mathematician Eratosthenes described a way to list all primes up to a limit. Write out the numbers, cross out every multiple of 2 after 2, every multiple of 3 after 3, and continue with the next uncrossed number. Whatever remains uncrossed is prime. The method is still taught today and is the basis of many computer programs that list primes.
How primes thin out
Primes become rarer as numbers get larger, but they never run out: Euclid proved more than 2,000 years ago that there are infinitely many. The prime number theorem describes how common they are: near a number n, roughly one number in every ln n is prime. Around 1,000,000, about one number in 14 is prime, while among the numbers up to 100, a quarter are.
Record primes
The largest known primes are Mersenne primes, of the form 2ᵖ − 1. In October 2024, a volunteer computing project found the prime 2 to the power 136,279,841, minus 1, a number with more than 41 million digits. Such records are found by special tests designed for Mersenne numbers, running on many computers over long periods.
Primes and encryption
Much internet security relies on the fact that multiplying two large primes is easy, while splitting the product back into its primes is extremely hard. In the RSA system, a public key includes the product of two secret primes, each hundreds of digits long. Anyone can encrypt a message with the public key, but only someone who knows the primes can decrypt it. The security depends on factoring being impractically slow for numbers of that size.
Why 1 is not prime
The number 1 has only one divisor, itself, so it does not meet the definition of having exactly two. Mathematicians also exclude it because every whole number above 1 can be written as a product of primes in exactly one way, apart from order. If 1 were prime, that uniqueness would break, since you could add any number of 1s to a factorisation.
Common mistakes
- Counting 1 as prime.
- Forgetting that 2 is the only even prime.
- Testing divisors beyond the square root, which wastes time, or stopping before it, which misses factors.
- Assuming large odd numbers ending in 1, 3, 7 or 9 are prime.
Related tools
To split a number into its prime factors, use Prime Factorization Calculator. For common factors, try GCF Calculator, and for remainders, Modulo Calculator.
Unsolved questions about primes
Some simple-sounding questions about primes remain unproven. Goldbach's conjecture states that every even number greater than 2 is the sum of two primes, such as 28 = 5 + 23; it has been checked by computer for enormous numbers but never proved. The twin prime conjecture, that there are infinitely many pairs of primes two apart such as 11 and 13, is also open. Questions like these keep primes at the centre of mathematical research.
Limits
Primality is tested exactly within the calculator's supported range; very large numbers may take longer to check.
Frequently asked questions
What is a prime number?
A whole number greater than 1 with exactly two divisors, 1 and itself. 2, 3, 5, 7, 11 and 13 are prime; 9 is not, because 3 × 3 = 9.
Is 1 a prime number?
No. A prime must have exactly two different divisors, and 1 has only one. Excluding 1 also keeps prime factorizations unique. Mathematicians call 1 a unit: it is neither prime nor composite.
How do you check if a number is prime?
Try dividing it by every prime up to its square root. If none divides evenly, it is prime. For 97, the primes to check are 2, 3, 5 and 7, and none divides 97.
What is the largest known prime?
The largest known primes are Mersenne primes of the form 2ᵖ − 1, found by the GIMPS distributed computing project. The record announced in October 2024, 2¹³⁶²⁷⁹⁸⁴¹ − 1, has more than 41 million digits.
How many primes are there below 100?
25: 2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, 59, 61, 67, 71, 73, 79, 83, 89 and 97.
Why are prime numbers important?
Every whole number above 1 factors uniquely into primes, which makes them the building blocks of arithmetic. Encryption such as RSA relies on how hard it is to factor the product of two huge primes.
Is 2 the only even prime?
Yes. Every other even number is divisible by 2, so it has at least three divisors and cannot be prime. All other primes are odd, which is why prime checks only need to try odd divisors after 2.
What are twin primes?
Pairs of primes that differ by 2, such as 3 and 5, 11 and 13, 17 and 19, or 41 and 43. Nobody has yet proved whether there are infinitely many twin primes; it is one of the oldest open problems in mathematics.