TOTP Generator (2FA Codes)
About this tool
About TOTP Generator
See the six-digit code an authenticator app would show, without the app. Paste a Base32 secret key or a complete otpauth://totp/ link and the generator shows the current time-based one-time password with a countdown ring, plus the previous and next codes so you can tell whether a rejected code is a clock problem. It follows RFC 6238 exactly: HMAC-SHA-1, SHA-256 or SHA-512, 6 or 8 digits and a period from 1 to 3,600 seconds, and settings inside an otpauth link are picked up automatically. Developers adding two-factor login can switch to Create a new secret to get a 160-bit random key, an otpauth link with issuer and account, and a QR code to scan with Google Authenticator, Microsoft Authenticator, Authy or a password manager. Codes are computed with your browser's Web Crypto API and the QR code is drawn locally. The secret never leaves this tab and is not stored, but treat it like a password: anyone who has it can produce your codes.
Built and maintained by Abhi JainUpdated
How to Generate TOTP Codes
- 1
Enter the secret
Under Use my secret, paste the Base32 secret key or the full otpauth:// link. Spaces and lowercase are fine.
- 2
Check the settings
Leave Algorithm on SHA-1, Digits on 6 and Period on 30 seconds unless the service says otherwise. Links set these for you.
- 3
Copy the code
Copy the current code before the countdown runs out, or use the next code if you are close to the end.
- 4
Or create a new secret
Choose Create a new secret, add an issuer and account, and scan the QR code with your authenticator app.
TOTP Generator: questions and answers
What is a TOTP code?
A time-based one-time password (RFC 6238). The code is HMAC(secret, floor(Unix time ÷ 30)) truncated to 6 digits, so the server and your app produce the same number without talking to each other, and it changes every 30 seconds.
Why doesn't my code match the authenticator app?
Almost always the clock: TOTP depends on the device time, so set it to update automatically. Also check the algorithm, digits and period. Some services use SHA-256 or 8 digits, and an otpauth link states which.
Is it safe to paste my 2FA secret here?
The code is computed in your browser with Web Crypto and nothing is sent, logged or saved. Still, the secret is as sensitive as a password, so only paste it on a device you trust and close the tab afterwards.
Where do I find my secret key?
When you turn on two-factor login, most services offer a "can't scan the code?" option that shows the key as text. The QR code itself contains an otpauth:// link with the same key.
Can I use this instead of an authenticator app?
It is meant for testing, recovery checks and developers. For daily logins keep the secret in an authenticator app or password manager rather than a browser tab.
How long should a TOTP secret be?
RFC 4226 requires at least 128 bits and recommends 160 bits, which is what Create a new secret generates: 20 random bytes shown as 32 Base32 characters.
Related Tools
- Secret Key GeneratorCryptographically secure 128–1024-bit keys in hex, Base64 or Base64url.
- Key Pair GeneratorEd25519, ECDSA and RSA key pairs in OpenSSH, PEM and JWK formats, generated in your browser.
- Password GeneratorStrong random passwords with a live strength and entropy estimate.
- Decrypt TextRead a message encrypted with Encrypt Text by entering its password.