2FA guide
What Is a TOTP Code?
TOTP stands for Time-based One-Time Password. It is the open standard (RFC 6238) behind the six-digit codes shown by Google Authenticator, Microsoft Authenticator, Authy and most other 2FA apps.
The idea in one sentence
Your authenticator and the website share a secret key; both combine that secret with the current time to calculate a short code, so if the codes match, the server knows you hold the secret — without the secret ever being sent during sign-in.
How the code is calculated
- Time is divided into steps, usually 30 seconds long. The number of steps since 1 January 1970 is the “counter”.
- The counter is signed with the shared secret using HMAC (SHA-1 by default, optionally SHA-256 or SHA-512).
- A few bytes are taken from the signature (“dynamic truncation”) and reduced to 6 or 8 decimal digits. That is your code.
Why the code changes every 30 seconds
Because the counter changes every time step, the code changes too. A code you saw a minute ago is useless to an attacker, which is what makes TOTP much stronger than a static password or an SMS that can be intercepted.
Most servers also accept the code from one step before or after the current one, to allow for small clock differences and the time it takes you to type.
Where the secret comes from
When you enable 2FA, the service generates a random secret and shows it as a QR code. The QR code usually contains an otpauth:// link with the secret encoded in Base32, plus the account name and issuer. Scanning it is simply a convenient way of copying that secret into your authenticator.
If you saved the Base32 text or the QR code, you can paste or upload it into our online generator to get the same codes in a browser.
TOTP vs. HOTP
HOTP (RFC 4226) is the older, counter-based variant: the counter increases each time you request a code instead of every 30 seconds. TOTP replaced it in most services because time-based codes expire on their own. This tool generates TOTP codes.
Frequently asked questions
Is TOTP secure?
Yes, as long as the secret stays private. TOTP protects against stolen passwords and phishing replay after the code expires, but anyone who obtains the secret itself can generate valid codes.
Does TOTP need an internet connection?
No. Only the secret and an accurate clock are needed, which is why authenticator apps work offline.
