About the 2FA Code Generator (TOTP)
Test two-factor authentication: see the current and next 6- or 8-digit codes for a secret key, create new secrets, and get an otpauth QR code to scan with an authenticator app.
Key features
- Current and next codes with countdown
- SHA-1, SHA-256 and SHA-512
- 6- or 8-digit codes, 30- or 60-second periods
- Generate new Base32 secrets
- otpauth:// QR code for authenticator apps
- Verified against the RFC 6238 test vectors
Test two-factor authentication codes
Enter a Base32 secret to see the current one-time code, with a countdown to the next one. Or create a new secret and scan the QR code with an authenticator app to check that your app and your server agree.
How TOTP works
- The service and your app share a secret key when you scan the QR code.
- Every 30 seconds, both compute HMAC(secret, time ÷ 30).
- The result is shortened to 6 digits. If the codes match, you're in.
Standard settings
| Setting | Usual value |
|---|---|
| Algorithm | SHA-1 |
| Digits | 6 |
| Period | 30 seconds |
| Secret | 160-bit (32 Base32 characters) |
The otpauth URI
otpauth://totp/Issuer:user@example.com?secret=JBSWY3DPEHPK3PXP&issuer=Issuer&algorithm=SHA1&digits=6&period=30
Related tools
Password strength checker, secret key generator, and QR code generator.
How to use the 2FA Code Generator (TOTP)
- Enter your text, password or settings in the tool above.
- Results appear instantly and are calculated in your browser.
- Read the explanation and warnings under the result.
- Copy what you need. Nothing is uploaded or stored.