Skip to content
AZ Tools

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.

Solve for
Size m
Memory
Hash functions k (best)
Bits per item
False-positive rate
About

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

LoadItemsRate
25%250,0003.585e-6
50%500,0000.02495%
75%750,0000.2363%
100%1,000,0001.000%
125%1,250,0002.745%
150%1,500,0005.770%
200%2,000,00015.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

  1. Choose what to solve for: the filter size, its false-positive rate, or its capacity.
  2. 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.
  3. Read the result and the load table, which shows the rate at 25 % to 200 % of the design capacity.

About this tool

Show

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