1 of 4

Your RightSignal

Learn1 / 3

HyperLogLog

The concept

How can a site count millions of unique visitors in 12 KB?

To count unique visitors exactly, you have to remember every visitor ID you've seen, so memory grows with the audience. HyperLogLog gives a close estimate using a small, fixed amount of memory, however many visitors arrive.

A hash function turns each ID into random-looking bits, and about one hash in 2ᵏ starts with k zeros. So if the longest run of leading zeros you've seen is 20, you've probably seen about 2²⁰, roughly a million, different IDs.

A repeat visitor produces exactly the same hash, so it can never raise that record. Duplicates cost nothing, and no list of past visitors is needed.