Bloom filter calculator

Enter how many items the filter will hold and the false positive rate you can accept, and get the number of bits, the memory size and the best number of hash functions. Or switch mode to check the false positive rate of a filter you already have.

Find
%
Bits (m)9,585,059 bit
Hash functions (k)7
About one false positive in
100
Size in bytes
1,198,133 B
Memory
1.14 MiB
Bits per item
9.59
Rate with these m and k
1.0039 %

Runs in your browser: nothing you enter is sent anywhere.

How to use it

  1. In Size for a target rate mode, enter the number of items and the false positive rate in percent (1 means one wrong yes per hundred lookups of absent items).
  2. Read the number of bits, the memory in bytes, KiB or MiB, and the number of hash functions.
  3. In Rate of a filter mode, enter n, m in bits and k to get the false positive rate and the best k for that size.

How it works

A Bloom filter is an array of m bits. Each item sets k bits chosen by k hash functions; a lookup checks those k bits. The formulas:

  • m = ⌈−n × ln p ÷ (ln 2)²⌉
  • k = round(m ÷ n × ln 2), at least 1
  • p = (1 − e^(−k × n ÷ m))^k

Because m is rounded up and k to a whole number, the real rate differs slightly from the target; the calculator shows it as Rate with these m and k.

Worked example

One million items at 1 %:

  • m = 1,000,000 × 4.6052 ÷ 0.48045 = 9,585,058.4, rounded up to 9,585,059 bits;
  • memory: 9,585,059 ÷ 8 = 1,198,133 bytes, or 1.14 MiB;
  • k = 9.585 × 0.6931 = 6.64, rounded to 7 hash functions;
  • the real rate with 7 hashes is 1.0039 %, about one false positive in 100 lookups.

Tips

  • Doubling the filter size does not halve the rate, it squares it (roughly): 1 % becomes about 0.01 %.
  • In code, two hash functions are enough to simulate k: h1 + i × h2 for i = 0 … k − 1.
  • If items must be removed, look at counting Bloom filters or cuckoo filters.

Frequently asked questions

What formulas does it use?

The standard ones: m = −n × ln p ÷ (ln 2)² bits, rounded up; k = m ÷ n × ln 2 hash functions, rounded to a whole number; and the false positive rate p = (1 − e^(−k × n ÷ m))^k, which is also used to show the real rate after rounding.

How many bits per item do I need?

About 4.8 for 10 %, 9.6 for 1 %, 14.4 for 0.1 % and 19.2 for 0.01 %: every tenfold drop in the rate costs about 4.8 more bits per item, whatever the number of items.

What happens if I add more items than planned?

The false positive rate grows. Use the Rate of a filter mode with your m and k and the larger n to see by how much.

Can a Bloom filter give false negatives?

No. If an item was added, the filter always says it may be present. It can only say yes to items that were never added (false positives), and a plain Bloom filter cannot delete items.

More in Developer

All tools in this category: Developer ·Updated November 4, 2026

Privacy choices

Google Analytics shows us which tools are used and whether they work. It may set cookies. Your choice is kept in this browser.