About the TOTP Code Generator
Test two-factor login during development, recover codes from a secret you saved, or create the QR code for a new secret.
Most two-factor login codes are TOTP codes: six digits that change every 30 seconds in apps such as Google Authenticator or Microsoft Authenticator. Each code is calculated from a shared secret key and the current time, using the HOTP and TOTP standards (RFC 4226 and RFC 6238). This page performs the same calculation in your browser.
Paste the Base32 secret that a website showed you when you set up two-factor login, and the current code appears with a countdown, plus the previous and next codes, which helps when clocks are slightly out of sync. You can switch between 6 and 8 digits, 30- and 60-second periods and the SHA-1, SHA-256 and SHA-512 variants used by some services.
Developers can create a new random secret, enter an issuer and account name, and scan the generated otpauth QR code into a phone to test their own login flow. The custom time field calculates the code for any Unix timestamp, which is handy for unit tests: the RFC 6238 test secret at time 59 gives 94287082 with 8 digits.
Because anyone who has the secret can create your codes, treat it like a password: use this page on your own device, never on shared computers, and do not share screenshots.
How to use the TOTP Code Generator
- 1Paste the Base32 secret key, or click New secret.
- 2Match the digits, period and algorithm to your service (usually 6 digits, 30 s, SHA-1).
- 3Read the live code, or scan the QR code with an authenticator app.
Key features
- Live code with countdown, previous and next codes.
- 6/8 digits, 30/60 s, SHA-1/256/512.
- Random secret generator.
- otpauth:// URI and QR code for authenticator apps.
- Custom time for testing.
Practical uses
- Testing two-factor login in development.
- Recovering access with a backed-up secret.
- Teaching how authenticator apps work.
Tips and common mistakes
- Keep your device clock synced automatically.
- Save backup codes from each service as well.
- Remove the secret from the page when you are done.
Limitations
- HOTP (counter-based) codes and Steam Guard codes are not supported.
- Codes depend on your device clock.
Privacy
Secrets are processed locally; the QR code is drawn in your browser.
Frequently asked questions
Why is my code wrong?
TOTP depends on time. Check that your device clock is correct to within a few seconds, and that digits, period and algorithm match the service.
Is it safe to paste my real secret?
The code is computed in your browser and nothing is sent, but anyone who sees your screen can copy the secret. Use it on a private device.
What standard is used?
RFC 6238 TOTP on top of RFC 4226 HOTP, compatible with Google Authenticator, Microsoft Authenticator, Authy and others.
Can I test a specific time?
Yes. Enter a Unix timestamp in Custom time to see the code for that moment.