1. Check your device time (the most common cause)
TOTP codes are calculated from the current time. If the clock on your phone or computer is off by even 30–60 seconds, your authenticator creates codes for the wrong moment and the website rejects every one of them.
- Windows: Settings → Time & language → Date & time → turn on Set time automatically, then click Sync now.
- macOS: System Settings → General → Date & Time → turn on automatic date and time.
- Android and iPhone: open the date and time settings and turn on automatic (network) time.
The time zone does not matter, because TOTP uses universal time. What matters is that the clock itself is correct.
2. Make sure you are using the right secret key
If you set up 2FA more than once, the website only accepts codes from the newest key. Codes from an older key look completely normal but are always wrong. Also check that:
- you copied the whole key, with no missing or extra characters;
- you did not mix up similar characters such as O and 0, or I and 1 (Base32 keys only use the letters A–Z and the digits 2–7);
- the key belongs to the right account, if you saved several in the 2FA code generator.
3. Enter the code before it expires
Each code is valid for about 30 seconds. If you type it as the countdown reaches zero, it may expire on the way. Wait for a fresh code and enter it right away. On the 2FA live code page you can also see the next code in advance, which helps when time is short, and check whether a code matches the current, previous or next one.
4. Check you are using the right kind of code
Some websites offer several methods. If the login page asks for a code sent by SMS or email, a code from your authenticator will not work, and the other way round. Look for a link such as "try another way" to switch to the authenticator option. Backup codes are also different: they are usually longer and can be used only once.
Quick fix checklist
- Turn on automatic time on your device and sync the clock.
- Reload the generator and wait for a brand new code.
- Confirm the secret key is the latest one for this account.
- Enter the code immediately, without spaces if the website does not accept them.
- If it still fails, use a backup code and set up 2FA again with a new key.
Still locked out? See how to recover a 2FA account for backup codes and official recovery options.
Frequently asked questions
Why does my 2FA code say invalid?
The most common reason is a wrong device clock. Other causes are an outdated secret key, a typing mistake, an expired code, or entering an authenticator code where the site expects an SMS code.
Does the time zone affect 2FA codes?
No. TOTP uses universal time, so the time zone does not matter. The clock itself must be correct, ideally set automatically.
Can I use an old 2FA code?
No. Each TOTP code is valid for only about 30 seconds and usually only once. Always enter the current code.
What if my 2FA code still does not work?
Use one of your backup codes to log in, then set up 2FA again so you get a new secret key. If you have no backup codes, follow the website's official account recovery process.