Probabilistic data structures

Design, explain, and test Bloom filters without the guesswork.

Curious about how Bloom filters behave as you change bit arrays, hash counts, or load factors? Jump into the editor to build one, then hop to the tester to see false positives in action. This landing page keeps the concepts close at hand while you experiment.

No false negatives guarantee Space-efficient membership checks False positives quantified
Live sketch
Insert → hash across 3 functions Bit array size: 16
Highlighted bits are set for the current item. FP estimate: 1.8%
Current action
Insert "alpha"
Confidence
No false negatives
Space savings
↘ ~92% vs. hash set

Why Bloom filters?

Great for: caches • pre-checks • stream processing

Fast pre-check

Quickly decide whether a lookup is almost certainly missing. If the filter says "no", you skip downstream database or network requests.

Memory wins

Represent millions of items in a compact bit array. Tune the bit-size and number of hash functions to balance space against false positives.

Predictable error

Bloom filters never give false negatives. False positives are bounded by math, so you can size the filter to meet your target error rate.

How it works

Play with it live in the editor
1) Hash the item several ways Run an element through k hash functions. Each hash maps to a bit position.
2) Set the bits For each hash output, flip the corresponding bit to 1. Reinsertions keep the same bits set.
3) Test membership Hash the candidate item with the same k functions. If all bits are 1 ➝ "probably present". Any zero ➝ "definitely missing".

Where to start

Open tools in new tabs to stay on this guide

Bloom Filter Editor

Adjust bit array size, number of hash functions, and visualize how inserts set bits.

Bloom Filter Tester

Benchmark false positives by loading word lists, simulating lookups, and seeing where errors spike.

Bring your own data

Both tools accept arbitrary text input. Try URLs, product IDs, or log lines to see how real-world entropy behaves.

Quick math

False positive rate and sizing

False positive rate

p ≈ (1 - e^{-k⋅n/m})^k
Lower p by increasing bits (m) or lowering inserted items (n).

Optimal hash count

Use k ≈ (m/n) ln 2. The editor lets you try different k values and watch how the bit density changes.

Density sweet spot

Once ~50% of bits are 1, false positives rise quickly. The tester visualizes this transition so you know when to resize.

Ready to explore?

Keep this guide open while you iterate. Open the editor to build, then the tester to validate.