Glossary
TOTP (time-based one-time password)
Definition
TOTP: Time-based one-time password: an algorithm (RFC 6238) in which an authenticator app and a service share a secret key and each computes the same short numeric code from that key and the current time, usually six digits that change every 30 seconds.
Also known astime-based one-time passwordauthenticator app codeauthenticator code
In short
TOTP (time-based one-time password, RFC 6238) is the algorithm behind the six-digit codes in authenticator apps. The app and the service share a secret key, and both compute the same code from that key and the current time, by default in 30-second steps. TOTP stops attacks that rely on a stolen password alone, but a fake sign-in page can still relay a code in real time.
Key takeaways
- TOTP is HOTP (RFC 4226) with the counter replaced by the current time, counted in 30-second steps by default.
- The setup QR code carries the shared secret. Anyone who copies it can generate your codes, so treat the setup screen like a password.
- The server holds the same secret as your app, unlike a passkey, where the server holds only a public key.
- NIST does not count typed one-time codes as phishing-resistant, because a fake page can relay them to the real site.
- Keep backup codes or a copy of the secret somewhere other than your phone.
Last reviewed 30 November 2026 by Foxcolab Team
TOTP, short for time-based one-time password, is the algorithm behind the six-digit codes in authenticator apps. During setup, the service and your app agree on a secret key. From then on, each side computes a short code from that key and the current time, and the code changes every 30 seconds by default. The algorithm is specified in RFC 6238, and it is a common second step in two-factor authentication.
How the code is made#
RFC 6238 defines TOTP as HOTP, the counter-based algorithm from RFC 4226, with the current time as the counter:
T = floor((current Unix time - T0) / X) X = 30 seconds and T0 = 0 by default
TOTP = HOTP(K, T)K is the shared secret. HOTP runs K and the counter through a one-way function and shortens the result to a code of at least six digits. An HOTP code stays valid until it is used. A TOTP code expires on its own.
The QR code you scan during setup is a way to copy K into the app. It usually encodes a key URI:
otpauth://totp/Example:alice@example.com?secret=JBSWY3DPEHPK3PXP&issuer=Example&digits=6&period=30The value after secret= is the key, written in Base32. Anyone who photographs that QR code can generate your codes for as long as the secret stays in use, so treat the setup screen like a password. Both sides need only the key and a clock, which is why the app works with no signal and why a phone clock that is minutes off produces rejected codes.
RFC 6238 gives the server two rules: allow at most one time step for delay, and never accept the same code twice.
What TOTP doesn't stop#
- Real-time phishing. A fake sign-in page can ask for your password and your code, then use both on the real site before the code expires. That relay is a man-in-the-middle attack. NIST's SP 800-63B-4 says authenticators that rely on manual entry of a code "SHALL NOT be considered phishing-resistant". A passkey is bound to the real site and closes that gap.
- A stolen secret. TOTP is a shared-secret scheme. The server has to compute the same code, so it keeps
Ktoo, and a breach of that store yields working codes. - A lost phone. Keep the service's backup codes somewhere other than the phone.
In Foxcolab#
Foxcolab's 2-Step Verification uses TOTP with six-digit codes that change every 30 seconds. Set it up under Security & Sign-in → Authenticator App, where you get a QR code, a Secret Key (manual entry) and eight backup codes. Turn on two-step verification has every step.
Keep exploring
Related terms
- Two-factor authentication (2FA)Two-factor authentication asks for a second kind of proof after your password, so a stolen password alone can't get someone into your account.
- PasskeyA passkey replaces a password with a key pair your device holds. The site stores only the public half, and the passkey works only on the site it was created for.
- PhishingPhishing is impersonation used to trick people into handing over passwords, approving payments or opening malware. Here's how it works and what actually stops it.
- Man-in-the-middle attackIn a man-in-the-middle attack, someone sits between two parties and relays their traffic so they can read or change it. Encryption helps only when you also verify who is on the other end.
- Recovery keyA recovery key is a secret that restores access to your encrypted data when you forget your password. In end-to-end encrypted services, it's often the only way back in.
Where Foxcolab uses it

Foxcolab
Private work tools, without the ads.
Mail, files, documents, spreadsheets and meetings in one account. Files, documents and spreadsheets are end-to-end encrypted.