Short answer

The short answer

TOTP stands for Time-based One-Time Password. It is the six-digit code an authenticator app shows, and it changes every 30 seconds. Your phone works it out from a secret key and the clock, so it needs no signal.

The name

What the name means

  • Time-based: the code comes from the current time, so it changes as time moves on.
  • One-time: each code is meant for one sign-in and stops working soon after.
  • Password: it is a short secret you type, like a password, but it is different every time.

How it works

How it works

  1. When you turn it on, the website shows a QR code (or a setup key you can type). That is a secret key, and your app saves it.
  2. The website keeps a copy of the same key. After that, the two never need to talk to each other.
  3. When you sign in, your app combines the key with the current time and shows a six-digit number. The website does the same sum and gets the same number.
  4. If your code matches, you are in. 30 seconds later, the time has moved on, so the code is different.

RFC 6238 puts the shared part like this: “The prover and verifier MUST either share the same secret or the knowledge of a secret transformation to generate a shared secret.” It recommends a 30-second step: “We RECOMMEND a default time-step size of 30 seconds.” Codes are usually six digits; RFC 4226, which TOTP builds on, says implementations “MUST extract a 6-digit code at a minimum”, and some apps and services use eight.

You can watch one being made in our guide Watch a 2FA code being made.

No signal needed

Why it works with no signal

Nothing is sent to your phone. The app already has the key and the phone already has a clock, so the code appears in airplane mode too. The website needs just the code you type.

The clock

Why your phone’s clock matters

The code is worked out from the time, so a clock that is wrong gives codes the website doesn’t expect. The RFC suggests a website allows at most one time step of delay (“We RECOMMEND that at most one time step is allowed as the network delay”), so a code from a clock that is well out of step is likely to be refused. If your codes are refused, check that your phone sets its date and time automatically.

Where you see it

Where you see it

  • A choice called “authenticator app” (some services say “authentication app”, or name TOTP) in the security settings of an account, next to text message or security key.
  • A QR code to scan while you set it up.
  • A setup key (a string of letters and numbers) to type in if you can’t scan the QR code.

Our guide Which apps and websites work with an authenticator app? shows where to find it, service by service.

Compared

TOTP, text-message codes and passkeys

TOTP (app codes)

  • Good: made on your phone and sent nowhere, so there is no phone number to take over; works with no signal; works with any authenticator app a service accepts.
  • Less good: you type it, so a fake website or a caller can talk you into giving it up, and it works for a short time after that; if you lose your phone and your app has no backup, the codes go with it unless you have backup codes.

Text-message codes

  • Good: nothing to install; the code arrives on any phone that gets texts.
  • Less good: the text goes to your phone number, not your phone, so a SIM swap sends your codes to someone else. Google says texted codes “can be vulnerable to phone number-based hacks”; the Canadian Centre for Cyber Security advises choosing options that do not rely on SMS where you can. They also need a signal.

Passkeys

  • Good: they can’t be typed into a fake website or read out to someone; there is no code to type.
  • Less good: not every service offers them yet; a passkey is as safe as the device or account that holds it.

Passkeys can’t be phished by a fake website the way a typed code can, so they’re worth using where a service offers them. An app code is a better choice than a text message. You can have more than one on the same account.

More: Why a code in an app beats a code by text message and Passkeys vs authenticator codes.

History

A little history

The Internet Engineering Task Force (IETF) published TOTP as RFC 6238 in May 2011. A draft of it was posted on 4 April 2008 (the IETF’s Datatracker lists draft-mraihi-totp-timebased-00 on that date). It builds on HOTP, which uses a counter instead of the time and was published as RFC 4226 in December 2005. RFC 6238 describes itself as informational: “published for informational purposes”.

Questions

Common questions

What if my phone’s clock is wrong?

Codes come from the time, so they may be refused. Set date and time to automatic, then try the next code.

Can I use any authenticator app?

For services that accept TOTP, yes: they work from the same key. GitHub’s help page says it is “app-agnostic when it comes to TOTP apps”. Not every service offers an authenticator app, so check its help page.

What happens if I lose my phone?

If your app has no backup, the codes on it go with it. Use a backup code the service gave you, then set the app up again. See our guides on backup codes and on what to do if you lose your phone.

Our app

MELKEM Authenticator

MELKEM Authenticator makes TOTP codes on your iPhone, with no account and no cloud sync.

Sources

Sources

IETF: RFC 6238, TOTP: Time-Based One-Time Password Algorithm (opens in a new tab) and RFC 4226, HOTP: An HMAC-Based One-Time Password Algorithm (opens in a new tab). The draft date is from the IETF Datatracker history of RFC 6238 (opens in a new tab).

Canadian Centre for Cyber Security: Secure your accounts and devices with multi-factor authentication (ITSAP.30.030) (opens in a new tab), which lists an authenticator app as something you have and advises choosing options that do not rely on SMS where possible.

GitHub Docs: Configuring two-factor authentication (opens in a new tab). Google Account Help: Turn on 2-Step Verification (opens in a new tab).

Ask MELKEM