Bloom Filter Calculator: Size, Hashes & Error Rate
Size a Bloom filter for n items at a target false-positive rate, or get a filter's error rate or capacity, with the best number of hash functions.
The usual formula gives 9,585,059 bits with 7 hashes, whose actual rate is 1.004% — above the target. 7,896 more bits reach it.
False-positive rate as the filter fills
| Load | Items | Rate |
|---|---|---|
| 25% | 250,000 | 3.585e-6 |
| 50% | 500,000 | 0.02495% |
| 75% | 750,000 | 0.2363% |
| 100% | 1,000,000 | 1.000% |
| 125% | 1,250,000 | 2.745% |
| 150% | 1,500,000 | 5.770% |
| 200% | 2,000,000 | 15.71% |
Checked against 60-digit mpmath arithmetic and real Bloom filters simulated at the 5-sigma level. Runs entirely in your browser.
How to use
- Choose what to solve for: the filter size, its false-positive rate, or its capacity.
- Enter the known values — items as 1000000, 1e6 or 1M, rate as 0.01, 1%, 1e-6 or '1 in 1000', size with a unit — and leave k blank for the best number of hashes.
- Read the result and the load table, which shows the rate at 25 % to 200 % of the design capacity.
About this tool
ShowHide
A Bloom filter answers 'have I seen this?' in a fixed number of bits, at the price of occasional false positives, never false negatives. Its behaviour is set by three numbers — the bits m, the hash functions k and the items inserted n — and this calculator solves for whichever you are missing: the smallest filter that holds n items at a target false-positive rate, the rate a filter of a given size will have, or how many items fit before the rate is exceeded. The rate is the standard (1 − e^(−kn/m))^k, evaluated so that targets as small as 1e-300 keep full precision. Most calculators size the filter with the continuous formula −n·ln p / ln²2 and then round k to a whole number, which quietly lands a little above the target — 4,000 items at 1e-7 gives 134,191 bits with 23 hashes and an actual rate of 1.0006e-7. This one searches for the smallest m whose best whole k really meets the target (134,196 bits here) and tells you when the usual answer falls short. Leave k blank for the best integer value, or fix it to see what your implementation's hash count costs. A load table shows how the rate climbs as the filter fills past its design size — at twice the design load, a 1 % filter is closer to 16 %. The formula assumes independent, uniformly distributed hash functions; two hashes combined as h1 + i·h2 (Kirsch–Mitzenmacher) are close enough in practice, but a weak hash or correlated keys will do worse than any figure here. The memory shown is the bit array alone, without the per-structure overhead of any particular library; counting and scalable Bloom filters need more.
Frequently asked questions
How many hash functions should a Bloom filter use?
For m bits and n items the rate is lowest at k = (m/n)·ln 2, which works out to about 0.7 hashes per bit-per-item: 7 for a 1 % filter, 10 for 0.1 %. Since k must be a whole number, the tool checks the integers on either side and keeps the better one.
Why is the size slightly larger than other calculators give?
Because they round k after sizing, and the rounded k usually misses the target by a small margin. This calculator returns the smallest number of bits that actually reaches the target with a whole number of hashes, and shows the conventional figure with its real rate when that one falls short.
What happens if I insert more items than planned?
Nothing breaks, but the false-positive rate rises quickly. The load table shows it: a filter sized for 1 % at n items is around 6 % at 1.5n and around 16 % at 2n. If growth is likely, size for the larger number or use a scalable Bloom filter.
Can I delete items from a Bloom filter?
Not from a plain one: clearing a bit could remove other items that share it. Counting Bloom filters replace each bit with a small counter to allow deletion, at several times the memory; cuckoo filters are another option.
How exact are these numbers?
The rate formula is the standard approximation and assumes ideal hash functions; for filters of more than a few hundred bits it agrees with measured rates to within sampling error, which is how it was checked here. It says nothing about a poor hash function or keys that collide by construction.
Related tools
Data Transfer Rate Converter
Convert data rate between bit/s, kbit/s, Mbit/s, Gbit/s, Tbit/s and B/s, kB/s, MB/s, GB/s, TB/s — all at once.
Convert
A/B Test Calculator (significance & sample size)
Compare two conversion rates: p-value, lift, Wilson and Newcombe intervals, a sample-ratio-mismatch check, and the sample size the next test needs.
Math & Statistics
What Is My Screen Resolution? (Hz and Scaling)
See your screen resolution, physical pixels, scaling (devicePixelRatio), browser window size, refresh rate, colour depth and HDR support at a glance.
Everyday
GIF Structure Inspector
Open a .gif and read its blocks: frame delays and disposal, loop behaviour, palettes, transparency, and how many bytes each frame really costs.
Image
JSON Schema Validator
Check a JSON document against a JSON Schema in your browser. Every error gets its JSON Pointer, the line it lands on, and the keyword that failed.
Developer
xxHash, MurmurHash3, FNV & SipHash Calculator
Compute xxHash32/64, MurmurHash3 (32 and 128-bit), FNV-1/FNV-1a (32 and 64-bit) and SipHash-2-4 of text, hex bytes or a file, with seeds and a key.
Developer