Sieve of Eratosthenes Visualizer — Find Primes
Animated Sieve of Eratosthenes on a number grid — marks primes and crosses out composites, with step controls. Runs in your browser.
Pseudocode
Run an operation to see its steps.
Avg · Worst
How to use
- 1 Type a limit n (up to 150) and press Run sieve.
- 2 Watch each prime get marked, then cross out all of its multiples as composite.
- 3 Step back and forward, or use Random for a different limit.
- 4 Green cells are prime, grey cells are composite.
Why use this tool
- See why the sieve only needs to start marking from p² for each prime p.
- Watch composite numbers fall away, leaving the primes highlighted.
- Understand the near-linear O(n log log n) running time.
- Runs entirely in your browser. No signup, no uploads.
Frequently asked questions
What is the Sieve of Eratosthenes?
An ancient algorithm for finding all prime numbers up to a limit n: repeatedly take the next unmarked number (a prime) and mark all of its multiples as composite.
What is the time complexity of the sieve?
O(n log log n) time and O(n) space — far faster than testing each number for primality individually.
Why does marking start at p² instead of 2p?
Every multiple of p smaller than p² (like 2p, 3p, …) already has a smaller prime factor and was marked when that smaller prime was processed, so starting at p² avoids redundant work.
Is 1 a prime number?
No. 1 has only one divisor, so by definition it is neither prime nor composite — the sieve treats it as a non-prime.
What is Sieve of Eratosthenes Visualizer?
A Sieve of Eratosthenes Visualizer animates the classic prime-finding algorithm: starting at 2, it marks each unmarked number as prime and crosses out all of its multiples as composite, leaving only the primes up to n.
Sieve of Eratosthenes Visualizer is a free algorithm utility by Zerethon Tools. Animated Sieve of Eratosthenes on a number grid — marks primes and crosses out composites, with step controls. Runs in your browser. Runs entirely in the browser — no signup, no upload.
- Category
- Algorithm
- Pricing
- Free
- Privacy
- Browser-based
- Signup
- Not required
Privacy
Your data never leaves your browser unless explicitly stated. Sieve of Eratosthenes Visualizer runs entirely client-side — no server upload, no logging, no tracking of your input.
Related tools
Bubble Sort Visualizer
Animated bubble sort with step controls, speed, custom input, live comparison/swap counters and pseudocode. Runs entirely in your browser.
Open toolInsertion Sort Visualizer
Animated insertion sort with step controls, speed, custom input, live comparison/write counters and pseudocode. Runs in your browser.
Open toolSelection Sort Visualizer
Animated selection sort with step controls, speed, custom input, live comparison/swap counters and pseudocode. Runs in your browser.
Open toolMerge Sort Visualizer
Animated merge sort with step controls, speed, custom input, live comparison/write counters and pseudocode. Runs in your browser.
Open toolBuild, share, and grow on Zerethon Social
Free signup. Earn points, collect achievements, and connect with creators worldwide.