Skip to content
toolgrid

No tool found. Try another word.

Prime Number Generator

List every prime number between two numbers, up to one trillion, with the count. Copy or download the list of primes.

Enter whole numbers from 0 to 1,000,000,000,000, with at most 10,000,000 between start and end.

Runs in your browser. What you enter is kept for 30 days to improve Toolgrid, then deleted.

How to use the Prime Number Generator

  1. 1 Enter the start and end of the range, for example 1 and 1000.
  2. 2 The primes in that range and their count appear immediately.
  3. 3 Copy the list or download it as a text file.

About the Prime Number Generator

The generator lists all prime numbers between a start and an end value, for example the 168 primes below 1000. It uses the sieve of Eratosthenes: starting from a list of all numbers, the multiples of each prime are crossed out, and the numbers that remain are prime.

For ranges that start high, such as 1,000,000,000 to 1,000,100,000, a segmented sieve is used: only the primes up to the square root of the end value are needed to cross out the multiples inside the range. That keeps it fast for any range up to one trillion, as long as the range spans at most 10 million numbers.

The count always covers the whole range. The list shows at most the first 10,000 primes, which keeps the page responsive; narrow the range to see the others. The count of primes below a number n is roughly n / ln(n), which is why primes become rarer as numbers grow.

Frequently asked questions

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.

How many primes are there below 1000?

168. Below 10,000 there are 1229 and below 1,000,000 there are 78,498.

What is the sieve of Eratosthenes?

An ancient method to find primes: write down the numbers, then repeatedly take the next number not yet crossed out (a prime) and cross out all its multiples.

Are there infinitely many primes?

Yes. Euclid proved over 2000 years ago that the list of primes never ends.

Why is the list cut off?

To keep the page fast, the list shows the first 10,000 primes. The count still includes all primes in the range.