A TOTP authenticator is an app that shows a new six-digit code every 30 seconds, which you type after your password to prove you really are you. It works offline, and the website and the app never send the code to each other: both work it out on their own. Picture two friends wearing watches synced to the second, each holding a copy of the same secret recipe. At any moment, each one mixes the recipe with the time on their watch and lands on the same number, without ever calling the other. That is all a TOTP authenticator does.
TOTP in one sentence
TOTP, short for time-based one-time password, is a short code made from a secret shared once between you and a website plus the current time, so it changes every 30 seconds and is useless soon after.
The method is an open standard, RFC 6238, published in 2011. Google Authenticator, Microsoft Authenticator, Authy, 2FAS, Aegis, the code generator built into Apple Passwords and many password managers all follow it, which is why one QR code works in any of them.
How a code is made, step by step
- The secret is shared once. When you turn on two-step login, the website shows a QR code. Inside it is a link starting with otpauth:// that holds a random secret key, the site’s name and your account name. Your app scans it and keeps the key. Many sites also show the same key as text, often called a setup key, for when scanning isn’t possible.
- The clock is cut into slices. Your phone and the website both look at the current time and split it into 30-second windows, counted from a fixed starting date. Everyone on Earth is in the same window at the same moment, whatever their time zone.
- Secret and time are mixed. The app feeds the secret key and the window number into a one-way scrambler called HMAC (by default it uses SHA-1 inside). The result is a long string of bytes that nobody can turn back into the secret.
- Six digits are picked out. A fixed rule picks a few of those bytes and turns them into a number, keeping the last six digits. That is the code on your screen. The website repeats steps two to four and checks that the numbers match, usually allowing one window either side in case a clock is a little off.
Thirty seconds, six digits and SHA-1 are the defaults. A few services use eight digits, a 60-second window or a stronger hash, and the QR link tells the app when that’s the case.
TOTP compared
An authenticator app is one of several ways to add a second step. Here is how it stacks up against text messages, its older counter-based cousin HOTP, and passkeys.
| Works offline? | Phishing-proof? | Risk if phone is lost | |
|---|---|---|---|
| TOTP app | Yes, the code is made on the phone | No, a fake site can pass a fresh code on within seconds | Codes are gone unless the app has a backup or sync; a finder still needs to unlock the phone |
| SMS code | No, it needs mobile signal | No, and it can also be stolen through SIM swapping | Low: your carrier can move the number to a new SIM |
| HOTP | Yes | No, and an unused code stays valid until the next one is used | Same as TOTP; often lives on a small hardware token instead of a phone |
| Passkey | No code to type; the device signs without needing signal | Yes, it only answers the real site it was made for | Synced passkeys come back on a new device; ones kept only on that phone need a backup sign-in method |
So in the TOTP vs SMS question, an app wins: no signal needed, and nobody can hijack it by talking your carrier into moving your number. In TOTP vs HOTP, the difference is what counts. HOTP (RFC 4226) moves forward with a counter each time you ask for a code, so an unused code doesn’t expire on its own. TOTP was built on HOTP and simply swaps the counter for the clock, which makes every code short-lived. That is why nearly every website now offers TOTP rather than HOTP.
Passkeys sit a step higher. If you are thinking about that move, our guide on moving from passwords to passkeys walks through it site by site.
Myth vs fact
- Myth: A TOTP code can’t be phished. Fact: It can, in real time. A convincing fake sign-in page asks for your password and code, and the attacker types both into the real site before the 30 seconds run out. TOTP stops someone who only has your leaked password; it doesn’t stop a live fake page. Passkeys do, because they refuse to answer the wrong site.
- Myth: The app needs the internet to get codes. Fact: Nothing is downloaded. The code comes from the stored secret and the phone’s clock, so it works on a plane or in a basement. Only syncing or backing up the secrets needs a connection.
- Myth: If someone sees one code, they can work out the next. Fact: Not without the secret key. The scrambling only goes one way, and a code from a past window is refused. The thing to protect is the secret, which is why you shouldn’t post or email a screenshot of the setup QR code.
- Myth: Keeping codes in a password manager makes two-step login pointless. Fact: It’s a trade-off, not a flaw. Someone who steals just your password from a site leak still can’t get in, because the code is in your locked vault, not on the site. You do rely more on that one vault, so a strong master password and two-step login on the manager itself matter. Some people keep the codes for their email and the manager in a separate app, and that’s a sensible choice too. More on this in common myths about password managers.
Choosing a TOTP authenticator
Any app that follows the standard will make the right codes. The differences show up the day your phone breaks. Look for:
- Backup or sync. Codes that live on one phone vanish with it. Pick an app that keeps an encrypted backup or syncs to your other devices, and check that it’s switched on.
- Export. You should be able to take your secrets with you if you change apps, not be locked in. Google Authenticator, Microsoft Authenticator and most open-source apps offer some form of transfer or export; check before you rely on one.
- A lock of its own. Face ID, a fingerprint or a PIN on the app keeps codes away from anyone who picks up your unlocked phone.
- Works offline. Codes should appear with no signal at all. Every proper TOTP app does this, so treat any that doesn’t as a warning sign.
Also save the backup codes each site gives you when you switch on two-step login, and keep them somewhere other than the phone. They are your way back in if everything else is lost.
PassHulk can be your TOTP authenticator as well. It keeps each site’s secret key inside your encrypted vault, next to the login it belongs to, shows the live code, and fills it in for you in browsers and apps, so there’s no switching between apps to copy six digits. Because the vault is encrypted on your device before it’s synced, the keys come back on a new phone after you sign in. You can see the full list on the PassHulk features page, and if you’re new to the idea, what a password manager is covers the basics.
Frequently asked questions
What is TOTP in simple words?
It’s a short code that your phone and a website each work out from a shared secret and the current time. Because the time keeps moving, the code changes every 30 seconds, so a code someone sees later is no use to them.
Why does my authenticator say the code is wrong?
Most often the phone’s clock is off. Turn on automatic date and time in your phone’s settings and try a fresh code. If it still fails, the secret may have been added to the wrong account, or the site was reset and needs you to scan a new QR code.
Can I move my TOTP codes to a new phone?
Yes, if your app syncs, has a backup or can export. If it can’t, sign in to each site on the old phone, turn two-step login off and on again, and scan the new QR code with the new app. Keep the old phone until every account works.
Back to the two friends with matching watches: their trick only works while the recipe stays secret and both watches keep good time. Look after the secret, let your phone set its own clock, and keep a backup of the recipe somewhere safe. Do that, and a TOTP authenticator quietly shuts out anyone who only has your password.



