Hash collision probability calculator

Collisions become likely at roughly the square root of the space, not at the space itself. That is the birthday paradox, and it halves your effective bits.

Collision probability
1.46937e-13%
= Exact Hash collision probability
One in how many
680 565 000 000 000
Items for a 50% chance
2.17194e+19
Square root of the space
1.84467e+19
Effective collision resistance
64.0 bits
Size of the hash space
3.40282e+38
Show the working
  1. Hash size = 128
  2. Number of items = 1 000 000 000 000
  3. Size of the hash space = 2^128 = 3.40282e+38
  4. exponent = 1 000 000 000 000 * (1 000 000 000 000 - 1) / (2 * 3.40282e+38) = 1.46937e-15
  5. Collision probability = 1.46937e-15 < 1e-12 ? 1.46937e-15 * 100 : (1 - exp(-1.46937e-15)) * 100 = 1.46937e-13
  6. Square root of the space = sqrt(3.40282e+38) = 1.84467e+19
  7. Items for a 50% chance = 1.1774100225154747 * sqrt(3.40282e+38) = 2.17194e+19
  8. Effective collision resistance = 128 / 2 = 64
  9. One in how many = 1.46937e-13 > 0 ? 100 / 1.46937e-13 : 0 = 680 565 000 000 000

Values are shown to six significant figures here; the arithmetic itself runs on exact fractions and is only rounded where a number is printed.

Scenarios & local history

Compare a saved scenario

Recent calculations

    The formula

    • P(collision) is about 1 - exp(-n(n-1) / 2N) for n items in a space of N
    • a 50% chance arrives at about 1.1774 sqrt(N) items

    A 128-bit hash has 64 bits of collision resistance, which is why 256-bit hashes are the modern default.

    Random UUID version 4 has 122 random bits; a trillion of them collide with probability around 1 in 10 million.

    Related calculators

    Settings

    Theme

    System follows your operating system and changes with it.

    Text size
    High contrast

    Maximises text and border contrast and removes the grid background.

    Graph-paper background

    Round to
    Notation
    Thousands separators
    Decimal mark
    Nearest fraction

    Shows the result as the nearest tape-measure fraction, with the error it costs.


    Accessibility & interaction
    Reduce motion Stops interface animations even when the operating system does not.
    Underline links Keeps links visually distinct without relying on colour.
    Larger touch targets Makes buttons and form controls easier to tap.
    Shorter reading lines Limits article width for easier scanning.
    Monochrome display Removes colour as an information cue.
    Always-visible focus Makes the keyboard focus ring persistent and stronger.
    Verbose screen-reader results Announces the complete conversion equation.
    Sticky action bars Keeps converter and calculator actions within reach.
    Select values on focus Replaces a value immediately when you start typing.
    Left-handed mobile layout Moves key mobile actions toward the left thumb.

    Your data

    Settings, recent conversions and favourites live in this browser only. Nothing is sent anywhere.

    Offline library