Skip to content
OTP Generator

Guide

What Is an OTP? One-Time Passwords Explained (SMS, TOTP and HOTP)

OTP means one-time password: a short code that works once. Learn the types of OTP (SMS, email, TOTP, HOTP), why they expire, which ones you can generate yourself, and how to stay safe.

6 min readUpdated November 14, 2026Fact-checked against RFC 6238

Quick answer

What does OTP stand for?

OTP stands for one-time password: a short code, usually 6 digits, that can be used only once and expires quickly. It is sent to you by SMS or email, or generated by an authenticator app from a secret key, and is used as the second step of two-factor authentication.

More answers
On this page

OTP in one sentence

An OTP (one-time password) is a short code, usually 6 digits, that proves it is really you and can be used only once, often only for a few seconds or minutes. Banks, apps and websites ask for one on top of your normal password, which is why OTPs are the most common form of two-factor authentication (2FA).

Because the code changes every time, a stolen OTP is almost worthless a minute later. That is the whole point: even if someone learns your password, they still need a fresh code that only you can get.

The four kinds of OTP you will meet

Every OTP is either sent to you by the service or generated on your side from a shared secret. That difference decides what you can and cannot do with it.

TypeWhere the code comes fromTypical lifetimeCan you generate it yourself?
SMS OTPThe service creates a random code and texts it to your numberA few minutesNo. Only the service knows it
Email OTPThe service creates a random code and emails itMinutes to an hourNo
TOTP (time-based)Your authenticator calculates it from a secret key and the current time30 seconds (sometimes 60)Yes, if you have the secret key
HOTP (counter-based)Calculated from a secret key and a counter that goes up with each useUntil the next code is usedYes, with the key and the counter

Authenticator apps such as Google Authenticator, Microsoft Authenticator and Authy all produce TOTP codes. Our guide on how TOTP works walks through the math step by step.

What an "OTP generator" actually does

An OTP generator is anything that calculates TOTP or HOTP codes from a secret key: an authenticator app on your phone, a password manager, a hardware token, or a web tool like the OTP generator on our homepage.

The secret key is shared once, when you turn on 2FA and scan a QR code (or copy the text key shown under it). From then on the service and your generator run the same formula independently. They never talk to each other, yet they arrive at the same 6 digits because they share the key and the clock. That is why a generator works offline and why the same key gives the same code in every app.

What a generator cannot do is produce an SMS or email OTP. Those codes are random numbers picked by the service and sent to you; there is no key to calculate them from. If a website claims it can "generate" your bank's SMS code, it is a scam.

Why OTPs expire so quickly

Short lifetimes shrink the window for an attacker. A TOTP code is valid for one 30-second step (most services also accept the step before and after to allow for small clock differences). An SMS code usually expires within a few minutes and is cancelled once used.

This is also why the time on your device matters. If your phone or computer clock is off by a minute or more, a TOTP generator will show codes the service rejects. Turning on automatic time fixes most "wrong code" problems; see why your 2FA code is not working for the full checklist.

How to stay safe with OTPs

  • Never share an OTP. No real bank, delivery company or support agent will ask you to read a code back to them. A caller asking for "the code we just sent" is trying to log in as you.
  • Prefer an authenticator app over SMS where the service allows it. SMS codes can be stolen through SIM-swap attacks; app codes stay on your device. Compare them in SMS vs authenticator app.
  • Back up your secret keys or save backup codes, so losing your phone does not lock you out.
  • Check the website address before typing a code. Phishing pages can ask for your password and a live OTP at the same time.

Frequently asked questions

What does OTP stand for?

OTP stands for one-time password: a short code, usually 6 digits, that can be used only once and expires quickly. It is sent to you by SMS or email, or generated by an authenticator app from a secret key, and is used as the second step of two-factor authentication.

Can I generate an OTP myself?

Only for TOTP or HOTP codes, and only if you have the secret key that the service gave you when you set up 2FA. SMS and email OTPs are random codes created by the service, so no app or website can generate them for you.

Is TOTP the same as OTP?

TOTP is one type of OTP. OTP is the general term for any one-time code; TOTP (time-based one-time password, RFC 6238) is the kind authenticator apps make, which changes every 30 seconds. HOTP (RFC 4226) is the counter-based variant.

How long is an OTP valid?

Authenticator (TOTP) codes last 30 seconds by default, with most services accepting one step either side. SMS and email codes usually last a few minutes. HOTP codes stay valid until a newer code from the same key is used.

Why is my OTP not working?

For authenticator codes the usual cause is a wrong device clock, so turn on automatic date and time. Other causes are a typo in the secret key, an old key after 2FA was reset, or the code expiring before you submitted it.

Need a code right now?

Paste your key and get the current 6-digit code in seconds. Free, private and nothing to install.