Prime Number Checker
Test whether a number is prime, see its smallest factor and full prime factorisation, or generate every prime up to a limit of one million.
Runs in your browser. Your files are never uploaded.
Loading Prime Number Checker…
How to use Prime Number Checker
- Type a whole number up to 9,007,199,254,740,992 (2^53) and press Check.
- Read whether it is prime or composite, its smallest prime factor and its prime factorisation.
- To list primes, enter a limit up to 1,000,000 and press List primes.
- Copy the list if you need it elsewhere.
Understanding primes
Every whole number greater than 1 is either prime or can be written in exactly one way as a product of primes. This is the fundamental theorem of arithmetic, and it is why prime factorisation is so useful: it lets you find greatest common divisors, least common multiples and simplified fractions.
Examples: 97 has no divisor up to its square root (9.8), so it is prime. 91 is composite because 91 = 7 × 13. 360 = 2^3 × 3^2 × 5.
How the methods work
To test a single number n, the checker only needs to look for divisors up to the square root of n, because a larger divisor would pair with a smaller one. For a number near 2^53 that means checking roughly thirty million candidates, which takes a fraction of a second to a few seconds depending on your device.
To list primes the tool uses the sieve of Eratosthenes: it marks the multiples of each prime as composite and keeps what is left. There are 25 primes up to 100 and 78,498 primes up to 1,000,000.
- Use it to check homework and number-theory exercises.
- Pick numbers for hash table sizes or examples in programming.
- Factorise numbers to simplify fractions or find common divisors.
Limits
The tool does not do cryptographic-size primality testing. Inputs larger than 2^53 are rejected. The list is capped at one million to keep the page responsive. Commas and spaces in the input are ignored. Everything runs locally.
Why use this prime number checker tool
- Exact up to 2^53. Numbers in this range are represented exactly by the browser, so the answer is reliable.
- Prime factorisation. Composite numbers are broken into prime powers such as 2^3 × 3^2 × 5.
- Prime list. A sieve of Eratosthenes lists every prime up to your limit and counts them.
- Fast and local. Trial division by numbers of the form 6k±1 runs on your device with no uploads.
Frequently asked questions
What is a prime number?
A prime is a whole number greater than 1 whose only positive divisors are 1 and itself. The first primes are 2, 3, 5, 7, 11 and 13. The number 1 is not prime and 2 is the only even prime.
How does the check work?
The tool tests divisibility by 2 and 3, then by every number of the form 6k−1 and 6k+1 up to the square root. Every prime above 3 has that form, so this skips two thirds of the candidates.
Why is there a size limit?
Beyond 2^53 ordinary numbers in the browser lose exactness. Very large primes also need probabilistic tests that this tool does not use.
More free tools
Calorie and BMR Calculator
Estimate your basal metabolic rate with the Mifflin-St Jeor equation, daily calories for your activity level, and calorie targets for losing or gaining weight.
Open toolPregnancy Due Date Calculator
Estimate your due date from the first day of your last period (with cycle length) or conception date, see weeks pregnant today and trimester dates.
Open toolFraction Calculator
Free fraction calculator for mixed numbers and fractions. Add, subtract, multiply or divide and get the simplified fraction, mixed number, decimal and steps.
Open tool