Hash Collision Probability Calculator
A hash collision occurs when two distinct inputs produce the same hash output. The probability of at least one collision among n hashed messages in a hash space of H values is approximated by the birthday bound formula: p = 1 minus e^(minus n^2 divided by 2H). Because the hash space H equals 2 raised to the number of output bits, even a modest 256-bit hash creates a space so large that finding a collision requires an astronomically large number of hashes. This calculator lets you enter the hash output size in bits and the number of messages hashed, then reports the collision probability.
Hash collision probability formula
H = 2bits
p = 1 - e(-n2 / (2H))
n50% = sqrt(2H × ln 2)
Where H is the hash space size (number of possible hash values), n is the number of messages hashed, and e is Euler's number. The formula n(50%) gives the number of messages needed to have a 50% probability of finding at least one collision, which for SHA-256 is approximately 2^128.
Collision resistance of common hash functions
- MD5 (128-bit): collision resistance approximately 2^64 operations. Practically broken.
- SHA-1 (160-bit): collision resistance approximately 2^80 operations. Practically broken for certificates.
- SHA-256 (256-bit): collision resistance approximately 2^128 operations. Currently secure.
- SHA-512 (512-bit): collision resistance approximately 2^256 operations. Very large safety margin.
- SHA-3-256 (256-bit): same bit length as SHA-256, collision resistance approximately 2^128 operations.
Hash collision probability calculator: frequently asked questions
What is the birthday bound approximation?
The birthday bound says the probability of at least one collision among n messages hashed into a space of H values is approximately 1 minus e^(-n^2 / (2H)). This closely matches the birthday paradox: in a room of 23 people, there is a 50% chance two share a birthday among 365 days.
What is the collision resistance of SHA-256?
SHA-256 produces a 256-bit output, giving a hash space of 2^256 values. The birthday bound means you need approximately 2^128 hashes to have a 50% chance of finding a collision. Current computing power cannot approach this threshold.
How many bits of output does SHA-3-512 provide?
SHA-3-512 produces 512-bit digests, giving a hash space of 2^512. Collision resistance is approximately 2^256 operations, far beyond any foreseeable attack capability.
Why does MD5 have collision vulnerabilities despite 128-bit output?
MD5's 128-bit output gives a birthday bound of 2^64 operations to find collisions, which is achievable. However, practical attacks on MD5 exploit structural weaknesses in the hash function itself, finding collisions far faster than the birthday bound would predict.
How is the hash space size H determined from output bits?
H equals 2 raised to the power of the hash output length in bits. For SHA-256 with 256-bit output, H = 2^256. For MD5 with 128-bit output, H = 2^128. Enter the number of output bits and this calculator computes H automatically.
Official sources
- NIST FIPS 180-4 Secure Hash Standard: csrc.nist.gov.
- NIST SP 800-107 Recommendation for Applications Using Approved Hash Algorithms: csrc.nist.gov.
Reviewed by the CalculatorHub team, edited by James Graham, 15 June 2026. See our methodology.