2FA Code Generator
Generate TOTP two-factor codes from a secret key or QR code.
How to use the 2FA Code Generator
- 1Paste the secret key or drop a screenshot of the setup QR code.
- 2See the current code and how long it stays valid.
- 3Use it to check your setup, or create a new secret and QR code.
About 2FA Code Generator
The 2FA Code Generator creates time-based one-time passwords (TOTP) as defined in RFC 6238, the same six-digit codes shown by authenticator apps such as Google Authenticator. Paste the setup key a service shows when you turn on two-factor authentication, an otpauth:// link, or a screenshot of the setup QR code, and you see the current code, a countdown to the next one and the code that follows.
Settings cover SHA-1, SHA-256 and SHA-512, 6 or 8 digits and 30 or 60 second periods, and the values in an otpauth link are applied automatically. A verify field checks a code from your phone against the current period and one period on either side, which helps to find a wrong clock or a mistyped key. In create mode you generate a new random 160-bit secret with an issuer and account name and get the setup QR code, the secret key and the otpauth link, for example to test a login you are building.
Developers use this TOTP generator to test two-factor logins, and anyone can use it to check that a key was copied correctly before relying on it. Treat setup keys like passwords: whoever has the key can create your codes.
Frequently asked questions
What is TOTP?
Time-based one-time password: an algorithm that combines a shared secret key with the current time, counted in 30-second steps, and turns an HMAC of both into a short code. Your phone and the server calculate the same code independently, so nothing has to be sent between them.
Why is my 2FA code not accepted?
Most often the device clock is off. TOTP depends on the exact time, and a difference of more than about one period produces codes the server rejects. Also check that the key was copied completely and that digits, period and algorithm match the service.
Can I use this instead of an authenticator app?
Not for everyday logins. Codes are only as safe as the key, and pasting real keys into a web page on a shared computer exposes them. Use it to test and check setups, and keep your accounts in an authenticator app or password manager.
Can it read Google Authenticator export QR codes?
No. Export codes (otpauth-migration links) bundle several accounts in a different format. Export accounts one at a time or use each service's setup key. Counter-based HOTP codes are not supported either.
Guides
More in Privacy & Security
Encrypt files and text with a password using AES-256, right in your browser.
See how long a password would take to crack and how to make it stronger.
Calculate SHA-256, SHA-512, SHA-1, MD5, SHA-3, BLAKE3 and CRC32 checksums of files and compare them.