Skip to content

Prime Number Generator

Generate all prime numbers within a range. Enter a minimum and maximum, and instantly list every prime number in between.

Category: math
Use Case: Math Education, Cryptography Learning, Programming Practice
Privacy: 100% browser-based
25 primes found
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

Recommended Settings

Pro Tips

  • A prime number is a whole number greater than 1 that has no divisors other than 1 and itself
  • This tool uses the Sieve of Eratosthenes, an efficient classical algorithm for finding all primes up to a limit
  • The range is capped at 5,000,000 to keep the calculation fast and avoid freezing your browser tab
  • Larger ranges take longer to compute since prime density decreases as numbers get larger

Most Popular

Most users generate primes in a range like 1-100 or 1-1000 for math education or programming exercises

When to Use This Tool

Math Education

Explore prime numbers and their distribution for a math class or self-study.

Cryptography Learning

Generate small primes to understand concepts used in cryptographic algorithms like RSA.

Programming Practice

Get a reference list of primes to test or verify your own prime-finding code.

Puzzle & Game Design

Find prime numbers within a specific range for puzzles, number theory games, or Project Euler-style problems.

How It Works

1

Create a boolean array covering every number up to the maximum value

2

Starting from 2, mark every multiple of each found prime as composite (not prime)

3

Collect all numbers that were never marked as composite - these are the primes

4

Filter the list down to only the primes that fall within your specified minimum and maximum

100% Private

Files never leave your device. All processing happens locally in your browser.

Lightning Fast

Powered by Sieve of Eratosthenes algorithm for optimal performance on modern browsers.

Open Source

Built with verified, open-source libraries. Fully transparent.

Frequently Asked Questions

What is the Sieve of Eratosthenes?

It's a classical, highly efficient algorithm for finding all prime numbers up to a given limit. It works by iteratively marking the multiples of each prime as composite, starting from 2, leaving only primes unmarked.

Why is the range limited to 5,000,000?

Finding primes up to very large numbers requires significant memory and computation. This limit keeps the tool responsive and prevents your browser tab from freezing or running out of memory.

Is 1 a prime number?

No. By definition, a prime number must be greater than 1 and have exactly two distinct positive divisors: 1 and itself. The number 1 only has one divisor, so it's excluded.

Is my data sent to a server?

No. The entire calculation happens locally in your browser using JavaScript. Nothing you enter is transmitted anywhere.

Why does a large range take a moment to calculate?

The sieve algorithm needs to process every number up to your maximum value, so larger ranges require proportionally more computation time and memory.