{"uid":"cap_aTToA_Fgf1iKe43vibP8M","slug":"security-math-birthday-collision-probability-f858b8a8","name":"Security Math – Birthday Collision Probability","description":"Birthday-problem collision odds for random IDs or hash outputs, or the count of items that reaches a target probability.","url":"https://security-math.x402tookit.com/birthday-collision?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":[],"properties":{"bits":{"type":"number","description":"Size of the ID or hash space in bits (e.g. 32, 64, 122 for UUIDv4, 128, 256); or use alphabetSize and idLength"},"items":{"type":"number","description":"Number of items generated: returns the collision probability"},"space":{"type":"number","description":"Or the number of possibilities directly (e.g. 365 for days in a year)"},"idLength":{"type":"integer","description":"Length of the random string ID, with alphabetSize"},"probability":{"type":"number","description":"Target collision probability, 0 to 1 exclusive: returns the number of items needed"},"alphabetSize":{"type":"integer","description":"Alphabet size of a random string ID (e.g. 62 for base62, 10 for digits); with idLength"}}}},"additionalProperties":false},"output":{"type":"object","required":["type"],"properties":{"type":{"type":"string"},"example":{"type":"object","properties":{"asOf":{"type":["null","string"]},"space":{"type":["null","string"]},"source":{"type":["null","string"]},"reasons":{"type":["array","null"],"items":{"type":"string"}},"summary":{"type":["null","string"]},"verdict":{"type":["null","string"]},"degraded":{"type":["boolean","null"]},"spaceBits":{"type":["null","number"]},"disclaimer":{"type":["null","string"]},"notChecked":{"type":["array","null"],"items":{"type":"string"}},"itemsNeeded":{"type":["null","number"]},"itemsNeededMethod":{"type":["null","string"]},"targetProbability":{"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_2KPh09OBCDqG0l_WFwC9S","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 birthday-problem collision probabilities for random IDs or hash outputs, or computes how many items are needed to reach a target collision probability.","exampleAgentPrompt":"What's the birthday collision probability if I generate 1 million random IDs using a base62 alphabet with length 12 — and how many can I safely generate before hitting a 1% collision chance?","exampleUseCases":[{"title":"UUIDv4 collision safety check","prompt":"I'm generating UUIDv4 identifiers for database rows — what's the birthday collision probability if I have 1 billion rows, and how many rows could I have before hitting a 0.1% collision chance?"},{"title":"Short token birthday risk for session IDs","prompt":"My app uses random 8-character base62 tokens as session IDs and I have about 500,000 active sessions — can you calculate the collision probability and tell me if that's dangerously high?"},{"title":"Truncated hash collision threshold","prompt":"If I'm using a 64-bit truncated hash output, how many items do I need to generate before there's a 50% chance of at least one collision?"}],"resultDescription":"Returns the collision probability given a space size and item count, or the number of items needed to reach a target probability. Includes the computed space size in bits, a human-readable summary and verdict, the method used, and a disclaimer. Fields: space, spaceBits, targetProbability, itemsNeeded, itemsNeededMethod, summary, verdict, source, asOf, degraded, reasons, notChecked, disclaimer.","failureModes":["Missing required parameter combination — must provide either (bits or space or alphabetSize+idLength) plus either items or probability; returns error if insufficient parameters","Probability out of range — probability must be strictly between 0 and 1 exclusive","Space too small — extremely small bit sizes may produce degenerate results","Invalid bits value — non-positive or non-numeric bits parameter rejected","Conflicting parameters — providing both items and probability simultaneously may be ambiguous"],"whenToPreferThis":"Use this endpoint when you need to mathematically quantify birthday-problem collision risk for random identifiers, tokens, hashes, or any discrete random space. Prefer it over generic probability calculators when the specific use case is collision detection for security-relevant IDs, since it understands bit-space sizing, base-N alphabets, and returns security-oriented summaries and verdicts. Ideal for developers auditing their ID generation schemes, security reviewers assessing token entropy adequacy, or agents reasoning about whether a random space is large enough for a given scale.","instructions":null,"reviewSummary":null,"reviewSummaryHighlights":null,"reviewSummaryConcerns":null,"reviewSummaryGeneratedAt":null,"activationCount":0,"lastUsedAt":null,"lastSuccessfullyRanAt":null,"lastHealthCheckAt":"2026-10-21T12:35:21.638Z","isFirstParty":false,"canonicalSlug":"security-math-birthday-collision-probability-f858b8a8"}