{"uid":"cap_f6Lb-08XoJydBOdjGSmba","slug":"security-math-bloom-filter-sizing-82b028ca","name":"Security Math – Bloom Filter Sizing","description":"Bloom filter sizing: bits, bytes and hash count for n items at a false-positive rate, or the rate for a given size.","url":"https://security-math.x402tookit.com/bloom-filter?utm_source=zero.xyz","method":"GET","headers":{},"bodySchema":{"type":"object","$schema":"https://json-schema.org/draft/2020-12/schema","required":["input"],"properties":{"input":{"type":"object","required":["type","method"],"properties":{"type":{"type":"string","const":"http"},"method":{"enum":["GET"],"type":"string"},"queryParams":{"type":"object","required":["n"],"properties":{"k":{"type":"integer","description":"Hash function count to evaluate (default: the optimum)"},"n":{"type":"number","description":"Number of items to store, 1 to 1e12"},"p":{"type":"number","description":"Target false-positive probability, e.g. 0.01 (give p or mBits)"},"mBits":{"type":"number","description":"Or the filter size in bits to evaluate"}}}},"additionalProperties":false},"output":{"type":"object","required":["type"],"properties":{"type":{"type":"string"},"example":{"type":"object","properties":{"asOf":{"type":["null","string"]},"human":{"type":["null","string"]},"items":{"type":["null","number"]},"kUsed":{"type":["null","number"]},"mBits":{"type":["null","number"]},"mBytes":{"type":["null","number"]},"source":{"type":["null","string"]},"reasons":{"type":["array","null"],"items":{"type":"string"}},"summary":{"type":["null","string"]},"verdict":{"type":["null","string"]},"degraded":{"type":["boolean","null"]},"optimalK":{"type":["null","number"]},"fillRatio":{"type":["null","number"]},"disclaimer":{"type":["null","string"]},"notChecked":{"type":["array","null"],"items":{"type":"string"}},"bitsPerItem":{"type":["null","number"]},"falsePositiveRate":{"type":["null","number"]},"targetFalsePositiveRate":{"type":["null","number"]}}}}}}},"responseSchema":null,"example":null,"exampleRequest":null,"tags":["x402"],"displayCostAmount":"0.02","displayCostAsset":"USDC","priceDynamic":false,"priceHint":null,"priceStatus":"priced","priceSource":"probe","requiresHandshake":false,"reviewCount":0,"rating":{"score":"0.00","successRate":"0.00","reviews":0,"stars":null,"state":"unrated"},"availabilityStatus":"unknown","priceObserved":null,"sessionDeposit":null,"pricing":{"kind":"static","summary":"$0.02/call","primary":{"kind":"static","protocol":"x402","network":"base","amountUsd":"0.02","per":"call","confidence":"exact"},"accepted":[{"kind":"static","protocol":"x402","network":"base","amountUsd":"0.02","per":"call","confidence":"exact"}]},"paymentMethods":[{"uid":"pm_wrPjES_y9PC7FW0SrxtDB","protocol":"x402","methodType":"crypto","chain":"base","mode":"charge","costAmount":"0.02","costPer":"request","priority":0,"asset":"0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913","unit":"request","depositMicros":null,"planRef":null}],"brandName":null,"brandSlug":null,"brandBaseUrl":null,"brandDocsUrl":null,"whatItDoes":"Calculates optimal Bloom filter parameters (bits, bytes, hash count, false-positive rate) given item count and target false-positive probability, or evaluates a given filter size.","exampleAgentPrompt":"What are the optimal Bloom filter parameters for storing 5 million items at a 0.1% false-positive rate — give me the bits, bytes, and ideal hash function count?","exampleUseCases":[{"title":"Cache deduplication memory planning","prompt":"I'm building a URL deduplication cache that needs to handle 10 million URLs with at most a 0.5% false-positive rate — what size Bloom filter do I need in bytes and how many hash functions should I use?"},{"title":"Evaluate fixed-size filter false-positive rate","prompt":"If I have a Bloom filter that's 64 megabits (67108864 bits) and I'm storing around 2 million items, what false-positive rate will I end up with and is the hash count optimal?"},{"title":"Spam filter Bloom filter design","prompt":"I want to design a Bloom filter for a spam detection system holding 500,000 known-bad email addresses at a 0.01 false-positive probability — calculate the bits, bytes, and optimal k for me."}],"resultDescription":"Returns a structured object with the computed filter size in bits (mBits) and bytes (mBytes), optimal hash function count (optimalK), actual hash count used (kUsed), resulting false-positive rate, bits per item, fill ratio, target false-positive rate, and a human-readable summary string. May include degraded flag, reasons, verdict, and disclaimer fields.","failureModes":["Missing required parameter n returns an error","n outside range 1 to 1e12 is rejected","Neither p nor mBits provided may result in incomplete or default calculation","p outside valid probability range (0,1) causes error","Non-numeric values for numeric parameters cause validation failure"],"whenToPreferThis":"Use this endpoint when you need mathematically precise Bloom filter sizing — specifically when you want to derive bits, bytes, and hash count from item count and false-positive probability (or vice versa), rather than estimating by rule of thumb. Prefer it over generic calculators when you need the full parameter set (mBits, mBytes, optimalK, fill ratio, bitsPerItem) in a machine-readable format suitable for automated infrastructure sizing or system design decisions.","instructions":null,"reviewSummary":null,"reviewSummaryHighlights":null,"reviewSummaryConcerns":null,"reviewSummaryGeneratedAt":null,"activationCount":0,"lastUsedAt":null,"lastSuccessfullyRanAt":null,"lastHealthCheckAt":"2026-10-21T12:39:36.245Z","isFirstParty":false,"canonicalSlug":"security-math-bloom-filter-sizing-82b028ca"}