← All Tools

Sieve of Eratosthenes Visualizer

Watch the classic prime-finding algorithm strike out composite numbers one factor at a time. Pick a range, press Run, and see primes emerge from the grid. Twin primes are highlighted in blue.

Prime Composite (struck out) Current prime Multiple being crossed Twin prime

Primes found

About the algorithm

The Sieve of Eratosthenes (c. 240 BCE) finds all primes up to n by repeatedly taking the next unmarked number as prime and marking all its multiples (starting from p²) as composite. Its time complexity is O(n log log n) — among the fastest classical ways to generate primes in a range. Twin primes are pairs (p, p+2) that are both prime; the twin prime conjecture (whether infinitely many exist) remains famously unresolved.