Skip to content
ENExplore Calculators

Birthday Attack Probability Calculator

Work out birthday attack probability instantly with clear inputs, formula shown and shareable results.

About Birthday Attack Probability Calculator

The birthday paradox means collisions appear after roughly sqrt(N) values rather than N, where N is the output space size. A hash with b output bits therefore offers only b/2 bits of collision resistance: SHA-256 gives 128 bits, and a 64-bit hash collides with even odds after about 5 billion values, which is why truncated hashes are dangerous as unique identifiers.

Formula

Birthday bound

P(collision) ~ 1 - exp(-k^2 / (2N)); k for probability p = sqrt(2 N ln(1/(1-p))); N = 2^bits

Worked example

With the default values below, Birthday Attack Probability Calculator returns Collision probability at this volume of 4.318e-60. Change any input above and every figure here is recalculated in your browser.

Inputs used

Hash output sizeaccepts 8–512 bits
256 bits
Values hashedminimum 1
1,000,000,000
Target collision probabilityaccepts 0–99.99 %
50 %

Results

Collision probability at this volume
4.318e-60
Birthday bound as a power of ten
38.53
Values needed to reach the target probability
10^38.6
Collision resistance
128 bits

Step by step

  1. 1Values used
  2. 2Birthday bound
  3. 3Collision probability at this volume= 4.318e-60
  4. 4Birthday bound as a power of ten= 38.53
  5. 5Values needed to reach the target probability= 10^38.6
  6. 6Collision resistance= 128 bits

Assumptions and limits

  • The result is derived only from the 3 inputs listed above. Anything not among them is not part of the calculation.
  • In particular, this calculator does not take inflation, tax, fees or charges or compounding frequency into account.
  • Figures are rounded for display to 2 decimal places, so totals built from several rounded parts can differ slightly from the unrounded arithmetic.

How these calculators are built and tested is described on the Methodology page. If a figure looks wrong, please report it.

Frequently Asked Questions

Why is collision resistance only half the hash length?

Because an attacker searches for any pair that matches rather than a specific preimage, and the number of available pairs grows quadratically with the number of values hashed.

Is a 128-bit hash safe for deduplication?

For collision resistance it offers 64 bits, which is reachable by a determined attacker. Use at least SHA-256 truncated to 160 bits or more where collisions have security consequences.

Birthday Attack Probability Calculator | Calcrivo