Bloom Filter Parameter Calculator
Calculate the optimal bit array size and hash function count for a Bloom filter from the expected number of items and a target false positive rate. Get an exact memory breakdown (bits, bytes, KB/MB/GB) and a false-positive-rate-vs-memory tradeoff chart.
Input
How many items you plan to insert into the filter.
Chance that an item never inserted gets wrongly reported as present. Lower means more accurate, at the cost of more memory.
Output
Optimal Bloom Filter Parameters
| Metric | Value |
|---|---|
| No data yet | |
Enter n and a target false positive rate to see the memory tradeoff.
Guides
Get the optimal bit array size and hash function count for a Bloom filter from the two numbers that actually drive them — how many items you expect to insert, and how much false-positive noise you're willing to accept.
How to use it
- Enter the expected number of items (n) you plan to insert into the filter.
- Drag the target false positive rate slider to the accuracy you need — lower means fewer false positives, but a bigger bit array.
- Read off the bit array size (m), hash function count (k), and the exact memory required, plus a chart showing how memory scales as you tighten the false positive rate at that same n.
The formulas
- Bit array size:
m = ceil(-n · ln(p) / (ln 2)²) - Hash function count:
k = round((m / n) · ln 2), with a floor of 1
These are the standard optimal-parameter derivations used by every mainstream Bloom filter implementation (Guava, Redis's BF.RESERVE, pybloom). Because m and k are rounded to whole numbers, the calculator also reports the actual false positive rate at those rounded values — using the standard estimate (1 - e^(-kn/m))^k — since it's rarely identical to the target you typed in.
Reading the chart
The chart plots memory required against target false positive rate, at your entered n, on a log scale for the false positive rate. Because m is linear in -ln(p), and the x-axis is -log₁₀(p), the tradeoff is a straight line rather than a curve — tightening the false positive rate by an order of magnitude costs a proportional, predictable jump in memory. Your current setting is marked with a red dot.
Limits
This sizes a standard (non-counting, non-scalable) Bloom filter, and assumes an ideal hash family — real hash functions with correlated bits will drift slightly from the theoretical false positive rate. It doesn't account for a specific language/library's per-bit overhead (some implementations round m up to a power of two or a machine-word multiple for faster indexing), so treat m/memory here as the theoretical minimum, not necessarily the exact allocation your library will make.
Privacy
Everything runs in your browser — nothing you enter is sent anywhere.
Related tools
If you need a hash for a Bloom filter's storage keys (or anything else), see the Hash Generator. Once your filter is sized, the Cache TTL Calculator helps figure out how long its entries should live if you're using it in front of a cache.
Use it from code
From 3 credits per callREST API
curl -X POST https://api.iotools.cloud/v1/tool/bloom-filter-parameter-calculator \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"n": "10000",
"targetFpRate": "1"
}'Swap in your own key from your account. The tool's fields are the body — no wrapper.
Ask an AI agent
Use the IOTools `bloom-filter-parameter-calculator` tool (Bloom Filter Parameter Calculator) on this input:
YOUR_INPUT_HEREPaste this at any agent connected to the IOTools MCP server, then add your input.