Quick answer: OTP codes expire because a shorter validity window is safer — a code that lives only a few minutes gives an attacker almost no time to use it, even if it’s intercepted or leaked. Most one-time codes die in 30 seconds to 10 minutes, or the instant they’re used. That’s not a glitch; it’s the design.

You get the code, go pour a glass of water, come back and type it — “code expired.” Annoying, but it’s proof the system is working. The whole point of a one-time passcode is that it’s one-time and short-lived.
1. Why expiry exists
One-time codes defend against replay: an attacker who captures a code trying to reuse it to log in. A short validity window shrinks that opportunity to almost nothing. Consider what it blocks:
- An intercepted text is useless minutes later.
- An old code you forwarded or screenshotted has already lapsed by the time anyone finds it.
- A code you were tricked into reading aloud may expire before the scammer types it in.
The shorter the window, the less time there is to abuse it. It’s also why many systems invalidate the current code and trigger a rate limit after a few wrong tries.
2. How different codes expire
| Type | Typical lifetime | How it expires |
|---|---|---|
| SMS / email code | 5–10 minutes | Server timer, voided at deadline |
| Authenticator app (TOTP) | 30-second window | Rolls over on a time step |
| Single-use | Immediately | Voided once used, timer or not |
| Backup codes | No expiry | One-time, each spent once |
SMS and email codes are timed server-side: the server records when it issued the code and checks the clock when you submit. Authenticator-app TOTP is different — it doesn’t send a code; your phone and the server each compute the same code from the current time, cycling every 30 seconds, so it inherently “expires” twice a minute.
3. Why a few minutes is the sweet spot
The window is a balance between security and usability. Too short and a bit of network delay means you can’t type it in time; too long and an intercepted code has more room to be abused. A few minutes comfortably covers “text crosses the carrier network plus you type it by hand” without handing attackers extra time. It’s the same trade-off logic behind why codes are 6 digits: enough, and no more.
4. Authenticator code always “expired”? Usually the clock
If your authenticator app’s codes keep getting rejected as if they expire instantly, the cause is almost always clock drift — TOTP relies on synced time, and if your phone is off by tens of seconds, its code won’t match the server’s. Turning on “set time automatically” usually fixes it in one tap. See authenticator code not working.
5. What to do when a code expires
- Request a fresh code — don’t retry the old one; it won’t come back.
- Enter it promptly rather than leaving it to do something else.
- Use the newest one. If several arrived, the older ones are usually dead.
- Don’t hammer resend. Back-to-back requests trip rate limits and make you wait longer.
FAQ
Q: Why does my code expire so fast? Most codes live only a few minutes by design. If it feels instant, check whether the text was delayed — by the time it reached you, much of the window may already be gone.
Q: Can I still use an expired code? No. An expired or used code is voided server-side; the only path is to request a new one.
Q: Why does my authenticator code change every 30 seconds? Because TOTP rolls over on fixed time steps; a 30-second window is the standard, keeping every code short-lived and unpredictable.
Takeaway
OTP expiry is a security feature, not a bug: a short window minimizes how long an intercepted or leaked code can be used. Enter codes promptly, always use the newest one, and if an authenticator code keeps “expiring,” check your phone’s clock sync.