TOTP / 2FA code simulator
Generate time-based one-time codes, like an authenticator app, from a secret.
Runs on your device · nothing is uploaded
New code in 30 s. Use a demo secret only: never paste the secret for a real account into any website.
How authenticator codes work
A time-based one-time password (TOTP, RFC 6238) is made from two things: a shared secret saved when you scan the QR code, and the current time. Every 30 seconds the time step changes, the app runs HMAC-SHA1 over the step number with the secret, and turns part of the result into a 6-digit code. The server does the same calculation, so the codes match without anything being sent.
- Codes depend on accurate clocks, so servers usually also accept the previous and next code.
- The secret is the real key: anyone with it can make valid codes forever. Keep it secret and never paste a real one into a website.
- TOTP is far stronger than SMS codes, but it can still be phished in real time. Passkeys and security keys resist phishing completely.
What is inside the QR code?
The QR code you scan when you set up an authenticator app holds a link such as otpauth://totp/FM%20TecHub:you@example.com?secret=JBSWY3DPEHPK3PXP&issuer=FM%20TecHub. The important part is the secret, written in Base32 (letters A–Z and digits 2–7). Your phone stores it and never needs to contact the server again.
Setting up 2-step codes safely
- Scan the QR code with an authenticator app, such as Microsoft Authenticator, Google Authenticator or a password manager.
- Enter the first code to prove it works.
- Save the backup or recovery codes somewhere safe and offline. They are your way back in if you lose the phone.
- If you change phones, move your accounts before wiping the old one.
Troubleshooting
- "Invalid code" every time: the phone's clock is probably wrong. Turn on automatic date and time.
- Lost phone: use a backup code, then remove the old device from your account settings.
- An unexpected request asks you for a code: never read a code out to a caller or type it into a page you reached from a link. That is how real-time phishing works.
Read our post on authenticator codes explained and the note on MFA and passwordless sign-in.
Frequently asked questions
What is a TOTP code?
A time-based one-time password (TOTP, defined in RFC 6238) is the 6-digit code an authenticator app shows. It is calculated from a shared secret and the current time and usually changes every 30 seconds.
Why do my TOTP codes not match the authenticator app?
The most common cause is the clock: TOTP depends on the time, so check that your device clock is set automatically. Also check that the secret was copied exactly and that the digits and period settings match.
Is it safe to paste a 2FA secret into this tool?
The tool runs entirely in your browser and uploads nothing. Even so, use it for testing and learning, not for the secrets of your important real accounts.