Bloom Filter Calculator
Enter the expected element count and false positive rate to get the optimal bit array size m and hash function count k for your Bloom filter.
Filter Parameters
How many distinct items will be inserted
Enter as a percentage — e.g. 1 means 1 in 100 false positives
Optimal Parameters
Bit array size
—
bits (m)
Hash functions
—
functions (k)
m = −n · ln(p) / (ln 2)²
|
k = (m / n) · ln 2
Details
Memory (bytes)
—
Memory (human)
—
Bits per element (m / n)
—
Actual false positive rate (after rounding)
—
Exact m (before rounding)
—
Exact k (before rounding)
—
Expected Bit Fill Rate
Fraction of bits set to 1 after inserting n elements: 1 − e^(−kn/m) — optimal Bloom filters aim for ~50%.
0%
—
100%
Summary
Enter the expected element count and false positive rate to get the optimal bit array size m and hash function count k for your Bloom filter.
How it works
- Enter the expected number of elements (n) you will insert into the filter.
- Set the desired false positive rate (p) as a percentage, such as 1% or 0.1%.
- The tool computes the optimal bit array size m = −n · ln(p) / (ln 2)² and rounds up to the nearest integer.
- It also computes the optimal hash function count k = (m/n) · ln 2, rounded to the nearest integer.
- Review memory usage, actual false positive rate after rounding, and bits per element.
- Adjust either input to explore the size–accuracy trade-off interactively.
Use cases
- Size a Bloom filter for a caching layer to reduce unnecessary database lookups.
- Design a duplicate-URL filter for a web crawler within a fixed memory budget.
- Choose hash function count and bit array size for a distributed key-value store.
- Estimate memory cost before implementing a Bloom filter in an embedded system.
- Verify that a published Bloom filter configuration is mathematically optimal.
- Teach probabilistic data structures by exploring the n–m–k–p relationship.
Frequently Asked Questions
Last updated: 2026-06-11 ·
Reviewed by Nham Vu