← 🧮 Algorithms

🧮 HyperLogLog: Counting Billions of Unique Items in a Few Kilobytes

Estimate: 0
True count: 0
Drag — rotate · Scroll — zoom

🧮 HyperLogLog: Counting Billions of Unique Items in a Few Kilobytes

This simulator shows how hashing items into buckets and tracking the longest leading-zero run per bucket lets you estimate a huge distinct-item count using only a small, fixed amount of memory.

🔬 What It Demonstrates

This simulator shows how hashing items into buckets and tracking the longest leading-zero run per bucket lets you estimate a huge distinct-item count using only a small, fixed amount of memory.

🎮 How to Use

Add items one at a time or in bulk, choose the number of buckets, and watch the per-bucket run lengths and the harmonically averaged cardinality estimate update as you go.

💡 Did You Know?

Redis caps its HyperLogLog structures at roughly 12 kilobytes no matter how many billions of items you add, yet still estimates cardinality within about 2 percent error.