Skip to content
OTP Generator

Guide

2FA Code Not Working? How to Fix Invalid Authenticator Codes

Getting "invalid code" from your authenticator? Fix the usual causes: clock drift, a wrong or old secret key, typos, the wrong account, HOTP mode or 8 digits.

7 min readUpdated November 12, 2026Fact-checked against RFC 6238

Quick answer

Why does my authenticator code say invalid when it looks right?

The most common reasons are a phone clock that is out of sync, an old secret left over from a previous 2FA setup, or a typo in a manually entered key. The code will look normal in every case, because the app has no way of knowing it was given the wrong inputs.

More answers
On this page

Start here: the 60-second checklist

Before digging deeper, run through these quick checks. One of them fixes the problem most of the time.

  • Is the code you typed from the right account entry? Many apps list several accounts from the same service.
  • Did the code expire while you were typing? Wait for a fresh one and enter it promptly.
  • Is your phone set to automatic date and time?
  • Did you reset or re-enable 2FA on this account recently? The old entry in your app may be dead.

If none of those help, work through the sections below in order.

Cause 1: your device clock is off

TOTP codes are calculated from the current time in 30-second steps. If your phone thinks it is 9:01:10 when it is really 9:02:00, it generates codes for the wrong time slice and the server rejects them. Most servers allow about one step of slack in either direction, so a drift of a minute or more is usually fatal.

Time zone does not matter, because TOTP uses UTC internally. What matters is that the clock is accurate.

  • Android: Settings, then System (or General management), then Date and time. Turn on automatic date and time. Google Authenticator on Android has also offered a "time correction for codes" option in its settings in some versions.
  • iPhone: Settings, General, Date and Time, then turn on Set Automatically.
  • Computers: enable internet time sync in your system settings.

A quick test: open our TOTP generator on a computer with a synced clock and compare the countdown with your phone. If the timers are visibly out of step, it is a clock problem.

Cause 2: wrong, old, or mistyped secret key

If you entered the setup key by hand, a single wrong character means every code will be wrong, forever, even though they look perfectly normal. Check for these common mistakes:

  • Confusing look-alike characters. Base32 keys only use letters A to Z and digits 2 to 7. If you typed a 0, 1, 8 or 9, it should almost certainly be the letter O, I, B, or a different character entirely.
  • Spaces and dashes. Keys are often shown in groups like ABCD EFGH IJKL. Most apps ignore spaces, but some tools do not. Lowercase is usually fine, but try uppercase if in doubt.
  • Missing characters. Long keys are easy to truncate when copying. Count the characters against the original.
  • An outdated key. Every time you disable and re-enable 2FA, or click "set up a new authenticator", the service creates a new secret. The old entry in your app keeps producing codes that will never work again. Delete it and add the current one.

If you still have the setup QR code or screenshot, our QR code to secret key tool can show you exactly which key and settings it contains, so you can compare it with what you typed.

Cause 3: wrong account, wrong service

It sounds obvious, but it is one of the most frequent causes. If you have personal and work accounts on the same platform, or test and production accounts, they will appear as similar entries. Some apps label entries only by issuer, so you might see three identical "GitHub" rows.

Look at the account name or email next to each entry. If nothing distinguishes them, edit the labels in your app once you know which is which. Also make sure you are on the right login page: some companies have separate systems for different products, each with its own 2FA.

Cause 4: non-default settings (8 digits, SHA-256, HOTP)

The vast majority of services use the defaults: TOTP, 6 digits, a 30-second period, and SHA-1. A minority use something else, and if your app silently ignored those settings, the codes will never match.

  • 8-digit codes. If the site asks for 8 digits and your app shows 6, the entry was set up with the wrong digit count.
  • SHA-256 or SHA-512. Some enterprise and crypto services use a different hash. A code generated with SHA-1 will not match.
  • Different period. A 60-second period is occasionally used.
  • HOTP instead of TOTP. HOTP is counter-based rather than time-based. If the service expects HOTP and your app is in time mode (or the reverse), codes will fail. HOTP counters can also drift out of sync if you generate codes without using them.

Scanning the original QR code usually carries these settings over automatically, because they are encoded in the otpauth:// link as parameters such as digits=8 or algorithm=SHA256. Manual entry often loses them. Our TOTP generator lets you set digits, period, and algorithm explicitly, which is handy for checking which combination matches what the service expects.

Narrow it down with a side-by-side test

When you are not sure which cause applies, compare two independent code sources. If you still have the original key, enter it into a second authenticator app or a local tool such as our TOTP generator and look at both codes at the same moment.

  • Codes match each other but the site rejects both: the key itself is outdated or belongs to another account, or the site expects different settings.
  • Codes differ by exactly one step: one of the clocks is off. Fix the time on the device that disagrees with an internet-synced clock.
  • Codes are completely different: the key was entered differently in the two places. Re-copy it carefully from the source.

This takes a minute and saves a lot of guessing.

Still stuck? Use your fallback

If you have checked everything and the codes still fail, stop retrying, since many services lock the account after several failed attempts. Instead:

  1. Use one of your saved backup codes to sign in.
  2. Go to the account's security settings, remove the broken authenticator, and set it up again from a fresh QR code.
  3. Save the new backup codes the service gives you.

If you have no backup codes, use the service's official recovery process. Our recovery guide explains what to expect. Only ever do this for your own accounts.

Frequently asked questions

Why does my authenticator code say invalid when it looks right?

The most common reasons are a phone clock that is out of sync, an old secret left over from a previous 2FA setup, or a typo in a manually entered key. The code will look normal in every case, because the app has no way of knowing it was given the wrong inputs.

Does time zone affect 2FA codes?

No. TOTP uses Unix time, which is based on UTC, so your time zone setting does not matter. What matters is that the actual clock is accurate. Turning on automatic date and time on your phone fixes nearly all time-related code failures.

Can I fix a wrong code by waiting for the next one?

If the code expired while you typed, yes. If every code fails, waiting will not help, because the problem is the clock, the key, or a setting mismatch. Repeated failures can also trigger a temporary lockout, so diagnose before trying again.

Need a code right now?

Paste your key and get the current 6-digit code in seconds. Free, private and nothing to install.