Skip to content
Calcrivo

OTP Lifetime Calculator

Balance one-time-passcode length, validity window and attempt limits against the odds an attacker guesses the code.

Inputs

digits
seconds

NIST SP 800-63B caps an out-of-band secret's lifetime at 10 minutes.

attempts
attempts/min

Chance an Attacker Guesses It

0.000300%

Possible Codes

1,000,000codes

Passcode Entropy

19.93bits

Effective Attempts per Code

3attempts

Attempts for a 50 % Chance

693,147attempts

Step by step

  1. Values used

    Passcode length = 6 digits; Validity window = 300 seconds; Attempts allowed per code = 3 attempts; Rate limit = 10 attempts/min

  2. OTP Lifetime

    P(guess) = 1 − (1 − 1 ÷ 10^digits)^attempts, where attempts is the lower of the per-code limit and the rate limit over the validity window.

  3. Break-even attempt count

    attempts for a 50 % chance = ln(0.5) ÷ ln(1 − 1 ÷ 10^digits).

  4. Chance an Attacker Guesses It

    = 0.000300

  5. Possible Codes

    = 1,000,000 codes

  6. Passcode Entropy

    = 19.93 bits

  7. Effective Attempts per Code

    = 3 attempts

  8. Attempts for a 50 % Chance

    = 693,147 attempts

How it works

A numeric OTP has almost no entropy — six digits is 19.93 bits, which an offline attacker would exhaust instantly. Its security comes entirely from the attempt limit and the validity window, so the guess probability is a binomial over a handful of tries against a million codes. Lengthening the code buys 3.32 bits per digit; tightening the attempt limit is usually the cheaper control. Without an attempt cap a six-digit code is trivially brute-forced in bulk, which is exactly how several high-profile SMS-verification bypasses worked; the maths shows how thin the margin is.

Formulas

OTP Lifetime

P(guess) = 1 − (1 − 1 ÷ 10^digits)^attempts, where attempts is the lower of the per-code limit and the rate limit over the validity window.

10^digits
Number of possible codes — 1,000,000 for six digits
attempts
Guesses the attacker gets before the code dies or throttling stops them

Break-even attempt count

attempts for a 50 % chance = ln(0.5) ÷ ln(1 − 1 ÷ 10^digits).

Frequently Asked Questions

How is OTP Lifetime calculated?

P(guess) = 1 − (1 − 1 ÷ 10^digits)^attempts, where attempts is the lower of the per-code limit and the rate limit over the validity window. A numeric OTP has almost no entropy — six digits is 19.93 bits, which an offline attacker would exhaust instantly. Its security comes entirely from the attempt limit and the validity window, so the guess probability is a binomial over a handful of tries against a million codes. Lengthening the code buys 3.32 bits per digit; tightening the attempt limit is usually the cheaper control.

Why does OTP Lifetime matter?

Without an attempt cap a six-digit code is trivially brute-forced in bulk, which is exactly how several high-profile SMS-verification bypasses worked; the maths shows how thin the margin is.

What values do I need to enter?

This calculator takes 4 inputs: Passcode length, Validity window, Attempts allowed per code, Rate limit. The pre-filled defaults are a realistic starting point — replace them with figures from your own environment for a result you can act on.

How long should an OTP live?

NIST SP 800-63B allows a maximum of 10 minutes for an out-of-band secret and 2 minutes is common practice for SMS. A longer window does not weaken the code directly, but it widens the interval in which a phished code can be replayed and gives a rate-limited attacker more attempts.

Is six digits enough?

Yes, with throttling: three attempts against a million codes is a 0.0003 % chance. Without throttling the same code falls to a few hundred thousand automated attempts. The attempt limit, not the digit count, is the control that matters.

You might also need