Bloom filter calculator
Pick items and a false-positive target, get bits and hashes, then overfill a toy filter and catch its false positives.
Empty filter: every bit is 0. Press play to insert the keys one by one, then test keys that were never inserted.
Never inserted: pick one to see its bits
Of 1,000 never-inserted keys, 8 (0.8%) come back "maybe"; the formula predicts 1%.
x: items inserted ÷ n · y: false-positive rate (log)
1% false positives costs 9.6 bits and 7 hashes per key: 1B keys fit in 1.2 GB, against ~100 GB for an exact set. A "no" is certain, a "yes" means maybe, so check the real store when a wrong yes matters.
How it's calculated · assumptions
m = −n·ln p ÷ (ln 2)² · k = (m/n)·ln 2 · FP(x) ≈ (1 − e^(−k·x/m))^k
Size for the peak: at 2× the planned items the same filter answers 15.7% of new keys wrong.
Sizing formulas and the 1% → ~9.6 bits/key, 7 hashes figures are from the probabilistic-structures concept; FP(x) is the standard estimate for independent, uniform hashes (Broder & Mitzenmacher, Network Applications of Bloom Filters: A Survey, 2004). k is rounded to a whole number, so the rate at n can differ slightly from the target. ~100 B per key for an exact set is the concept's web-crawler assumption. Toy filter: same bits per key, k seeded hashes (FNV-1a with a murmur3 finalizer); keys are fixed strings, so it repeats.