This 2FA code generator calculates the one-time two-factor authentication code from your secret key, exactly as Google Authenticator or any other authenticator app does. Paste the key or an otpauth:// link into the field above and you’ll immediately see the current code, a bar showing the seconds left, and the next code. Everything is calculated in your browser using the TOTP standard; the key isn’t sent anywhere or stored.
Below we explain what 2FA and TOTP are in plain English, where to find your secret key, when an online generator makes sense and when an app on your phone is the better choice, why a code might be rejected, and how not to get locked out of your accounts if you lose your phone.
How to get a 2FA code from a secret key
- 1Keyfrom the service’s 2FA settings
- 2Pasteinto the field at the top of the page
- 3Codeappears instantly, refreshes every 30 s
- 4Copywith one click on the code
- Copy the secret key — a string like JBSW Y3DP EHPK 3PXP that the service shows next to the QR code when you set up 2FA — or the full otpauth:// link.
- Paste it into the field above. Spaces, hyphens and lowercase letters are fine. The code appears straight away; there’s no button to press.
- Click the code to copy it and paste it on the site before the bar runs out.
What the generator shows
- The current code — usually 6 digits.
- A timer — how many seconds the code is still valid.
- The next code — so you don’t have to wait if there are only 2–3 seconds left.
- The account name, if you pasted an otpauth:// link that includes a label.
otpauth:// links
If the link specifies non-standard settings — 8 digits instead of 6, a 60-second period instead of 30, or the SHA-256 or SHA-512 algorithm — the generator applies them automatically. Just paste the whole link.
What is 2FA (two-factor authentication)?
| SMS code | TOTP code | Passkey / security key | |
|---|---|---|---|
| Needs mobile signal | ✓ | ✕ | ✕ |
| Works offline | needs signal | ✓ | ✓ |
| Vulnerable to SIM swap | ✓ | ✕ | ✕ |
| Can be entered on a phishing site | ✓ | ✓ | ✕ |
| Supported by services | almost all | most | more and more |
| Recovery if you lose your phone | via your carrier | backup codes or key | backup key |
2FA, or two-factor authentication, means signing in with two independent things. The first is something you know: your password. The second is something you have — a phone with an authenticator app, a SIM card, a security key — or something you are, like a fingerprint. Even if your password is stolen, nobody can sign in without the second factor. You’ll also see it called two-step verification or multi-factor authentication (MFA).
Types of second factor
Not all methods are equally secure. The most common balance between convenience and protection is a code from an authenticator app (TOTP), which is exactly what this generator calculates. Passkeys and hardware security keys go further, because they can’t be used on a phishing site.
What is TOTP and how is the code calculated?
- 00:00code 492 039
- 00:30code 815 274
- 01:00code 306 118
- 01:30code 627 950
TOTP (Time-based One-Time Password) is an open standard, RFC 6238. It’s used by Google Authenticator, Microsoft Authenticator, password managers and almost every site that offers codes “from an app”. Because it’s a standard, a key from any website works in any authenticator.
How it works
- When you turn on 2FA, the service and your authenticator receive the same secret key.
- The current time is divided into 30-second intervals, giving an interval number.
- An HMAC cryptographic signature is calculated from the key and the interval number (with SHA-1 by default).
- A number is extracted from the signature and cut down to 6 digits. That’s your code.
The server performs the same calculation and compares the result. Nothing is transmitted in advance, so the authenticator doesn’t need an internet connection, just the correct time.
| Parameter | Default | Other options |
|---|---|---|
| Digits | 6 | 8 |
| Period | 30 seconds | 60 seconds |
| Algorithm | SHA-1 | SHA-256, SHA-512 |
| Key format | Base32: letters A–Z and digits 2–7 | — |
Where to find your 2FA secret key
The secret key is shown only once, when you turn on two-factor authentication. Afterwards most services don’t let you view it again in the settings.
- On the screen with the QR code, look for a link such as “Can’t scan it?”, “Enter a setup key” or “Show key”.
- The key is 16–32 characters of Latin letters and the digits 2–7, often split into groups of four.
- The QR code itself contains a link like otpauth://totp/Service:login?secret=KEY&issuer=Service. If you have that link, paste the whole thing.
If you don’t have the key
If 2FA is already on and you didn’t save the key, go to the service’s security settings, remove the authenticator and add it again. You’ll get a new key, and the old one will stop working.
When an online 2FA generator makes sense, and when it doesn’t
Good uses
- Checking a key before you rely on it. After setting up 2FA, compare the code in your app with the code here to make sure the key was saved correctly.
- No phone to hand, but the key is stored in your password manager on your computer.
- Work and test accounts whose keys are kept with other credentials, for example in a team that manages client social media pages.
- Moving to a new authenticator: confirming that keys exported from the old app produce the right codes.
Not a good idea
- For your main email, bank, crypto wallet or government accounts (such as GOV.UK One Login or Login.gov). For these, the key should live in one protected place: an app on your phone or a hardware key.
- On someone else’s, a work or a public computer.
- As a permanent replacement for an authenticator: if the key sits next to the password in the same note, your two factors effectively become one.
Security: what happens to your key on this page
The code is calculated by Web Crypto, the cryptography module built into your browser. The page doesn’t send the key to a server and doesn’t save it in cookies or browser storage. When you close the tab or clear the field, the key is gone.
What could still see the key
- Browser extensions with access to all websites. For working with keys, use a browser profile without unnecessary extensions.
- The clipboard, especially if your phone keyboard keeps a clipboard history or syncs it between devices.
- A compromised device with malware. No generator can help with that.
Where to keep keys
Safely: in a password manager with TOTP support (Bitwarden, 1Password, KeePassXC and others can show codes) or in an authenticator app with an encrypted backup. For your most important accounts, keep 2FA separate from the password: the password in your manager, the codes in an authenticator on your phone.
2FA code not working: causes and fixes
| Cause | Fix |
|---|---|
| Wrong time on your computer or phone | Turn on automatic date and time in your system settings. Even a 30–60 second difference produces the wrong code. |
| The code expired while you were typing | Wait for the new code, or use the next one if only a few seconds are left. |
| A mistake in the key | Copy the key again. If typing it by hand, check O/0 and I/1: keys only contain the letters. |
| Non-standard settings (8 digits, 60 s, SHA-256) | Paste the full otpauth:// link so the generator can read the settings. |
| The key has been replaced | If 2FA was reset, the old key no longer works. You need the new one. |
| Too many failed attempts | The service may have temporarily locked sign-in. Wait and try again with the correct time. |
What the generator doesn’t support
- HOTP — counter-based rather than time-based codes (otpauth://hotp/… links). The generator only calculates TOTP.
- Steam Guard — uses its own letter-based code format.
- Push approvals (“Is this you signing in? Yes/No”) and SMS codes — these aren’t derived from a key.
Google Authenticator, Microsoft Authenticator and password managers
All popular authenticators use the same TOTP standard for third-party sites. So the code our generator shows for a given key matches the code in your app, which is a handy way to check that the key is right.
| App | Notes |
|---|---|
| Google Authenticator | Simple; can sync codes to your Google Account and export accounts via QR code to move them to a new phone. |
| Microsoft Authenticator | Standard TOTP codes for third-party sites; push approvals for Microsoft accounts. |
| Password managers with TOTP | The code sits next to the password with autofill. Convenient, but the password and the second factor end up in the same vault. |
| Hardware security keys | Some models can store TOTP keys and show codes through a companion app; the strongest protection against key theft. |
Moving codes to a new phone
Before you reset or sell your old phone, transfer your accounts using the app’s export feature or turn on sync. Save backup codes for every important service: if the transfer fails, they let you sign in and set up 2FA again.
Backup codes and account recovery
- The service accepted the code from your app
- Backup codes are saved somewhere other than your phone
- The key is correct (code here = code in the app)
- Recovery email and phone on your profile are current
- Your device sets the time automatically
The most common 2FA problem isn’t hacking, it’s a lost phone. Sort out a backup way in before you need it.
- Backup codes. Almost every service offers 8–10 single-use codes when you enable 2FA. Store them in your password manager, or print them and keep them with your important documents.
- A second sign-in method. Add a backup authenticator or a passkey on another device.
- Up-to-date recovery details. The recovery email and phone number on your profile should be yours and working. A temporary email won’t do: those inboxes disappear.
- An encrypted copy of your keys. If you keep secret keys, keep them only in a password manager or an encrypted file, never in plain notes.
2FA for work accounts and multiple profiles
Social media managers, agencies and support teams often look after dozens of client accounts. Each one gets 2FA, and the keys are stored in a shared team password manager. That’s where an online generator helps: getting a code quickly when the right phone isn’t nearby.
What else is worth separating
- Phone number. If a service asks for an SMS at sign-in, a separate number per work account keeps things tidy. For a one-off confirmation, a number for receiving SMS will do; for regular logins, rent a number for anything from a day to several months. Services and countries are in the catalog.
- IP address. Services link sign-ins to different accounts from the same address. Separate profiles typically use proxies, and What is my IP shows what websites see about your connection.
- Password. A different one for each account, from our password generator.