Skip to content

Prime Number Generator

Generate prime numbers up to N or the first N primes

Privacy: your files never leave your device. All processing happens locally in your browser.

How to use

  1. 1.Choose a mode: "Primes up to N" to list every prime up to a limit, or "First N primes" to get a fixed count of primes.
  2. 2.Type your value for N into the box and press Generate primes (or hit Enter).
  3. 3.Read the prime numbers list along with the total count, the sum of all primes and the largest prime.

About Prime Number Generator

A prime number is a whole number greater than 1 that has exactly two divisors: 1 and itself. The first few primes are 2, 3, 5, 7, 11 and 13, and 2 is the only even prime. This prime number generator builds a list of prime numbers instantly in your browser, so nothing is uploaded, there is no queue, and there are no server limits on how many primes you can list.

Under the hood it uses the Sieve of Eratosthenes, the classic algorithm for listing primes. Instead of testing each number for divisibility one at a time, the sieve starts with all the integers up to a limit and repeatedly crosses out the multiples of each prime it finds: first the multiples of 2, then of 3, then of 5, and so on. Whatever survives has no smaller factor and is therefore prime. This runs in about O(n log log n) time, which makes it dramatically faster than trial division and lets the tool sieve into the millions in a fraction of a second.

There are two modes. "Primes up to N" lists every prime number less than or equal to the limit you enter. "First N primes" returns exactly the first N primes in order, using a proven upper bound for the N-th prime so the sieve knows how far to reach. For each result you get the full list of prime numbers plus the count, the sum of all the primes, and the largest prime found, and you can copy the whole list with one click.

Some useful anchors to sanity-check any list of prime numbers: there are 25 primes below 100 and 10 primes up to 30. The 25th prime is 97, the 100th is 541, the 1000th prime is 7919, and the 10,000th is 104,729. Knowing these makes it easy to verify results by hand. Primes also thin out as numbers grow β€” the Prime Number Theorem says the count of primes below n is roughly n divided by the natural log of n β€” yet they never run out, and curiosities like twin primes (11 and 13, or 17 and 19) keep appearing.

Prime numbers show up everywhere. Teachers and students use them for number-theory lessons, factoring practice and building factor trees. Programmers use a prime generator as a benchmark exercise and as a building block for hash tables, pseudo-random sequences and coding challenges on sites like Project Euler. Cryptography leans on large primes for algorithms such as RSA, where the difficulty of factoring a product of two big primes is what keeps encrypted data secure. Whether you need a quick prime numbers list for homework, a reference table to print, or deterministic test data for code, this free tool generates the exact list you ask for instantly and entirely on your own device.

Frequently asked questions

What is the Sieve of Eratosthenes?
It is a classic algorithm for finding all prime numbers up to a limit. You start with the integers from 2 upward and repeatedly cross out the multiples of each prime you find β€” first multiples of 2, then 3, then 5, and so on. The numbers that are never crossed out are prime. It runs in roughly O(n log log n) time, which is why it can list primes into the millions almost instantly.
How many prime numbers are there under 100?
There are exactly 25 prime numbers below 100: 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. For comparison, there are 10 primes up to 30.
What is the 1000th prime number?
The 1000th prime is 7919. Other handy anchors: the 100th prime is 541, and the 10,000th prime is 104,729. Use the "First N primes" mode to reproduce any of these.
Is 1 a prime number?
No. A prime number must have exactly two distinct divisors, 1 and itself. The number 1 has only one divisor, so it is not prime, and 0 is not prime either. The smallest prime number is 2, which is also the only even prime.
What is the largest N this tool supports?
In "Primes up to N" mode you can sieve up to N = 10,000,000. In "First N primes" mode you can request up to N = 100,000 primes (the 100,000th prime is 1,299,709). Larger values are blocked to keep the tool fast and responsive in the browser.

Calculators guides

View all