Bloom filters · quick reference

Bloom filter cheat sheet

Bloom filterFormulasTuningBloom filtersData structures

Published

Never lies about absence; only exaggerates presence. “Not present” is certain; “present” is probable. That asymmetry is why it guards expensive lookups.

What it is

The math

QuantityFormula
False-positive rate(1 − e^(−kn/m))^k
Optimal hash countk = (m/n)·ln 2
FP rate at optimal k(0.5)^k
Bits/item (m/n)Optimal k≈ FP rate
86~2%
107~1%
1611~0.05%

Where it lives / when not to

Variants (one line each)