Is your clock the reason your 2FA codes fail?
TOTP codes are calculated from your device’s clock. If it has drifted, every code you produce lands in the wrong 30-second window and the server rejects it. This checks your clock against our server and tells you by how much.
The reference is the HTTP Date header from this site’s own server, corrected for round-trip latency. Accuracy is roughly one second — plenty, because TOTP tolerates far more than that before codes break.
Why a wrong clock breaks two-factor authentication
A TOTP code is not stored anywhere and never travels over the network. Your device and the server each calculate it independently, from two ingredients: the shared secret key, and the current time rounded down to a 30-second step. When both sides agree on the time, both produce the same six digits.
Drift the clock by more than one step and the two calculations land in different windows, so the digits no longer match. Most servers accept one window either side to allow for small differences, which is why a device that is ten seconds off usually works and a device that is a minute off never does. The secret key is fine. The code is fine. The clock is the problem.
How to fix a drifting clock
Windows
Settings → Time & language → Date & time. Turn on Set time automatically, confirm the time zone is right, then click Sync now. If sync fails, the Windows Time service may be stopped — run services.msc and set Windows Time to start automatically.
macOS
System Settings → General → Date & Time. Enable Set time and date automatically. If it is already on and still wrong, toggle it off and on to force a fresh sync.
Android
Settings → System → Date & time. Turn on Set time automatically (sometimes called Use network-provided time). Note that this uses the mobile network's time, which on some carriers is slightly off — if it stays wrong, disable it and set the time manually against a reliable source.
iPhone and iPad
Settings → General → Date & Time. Enable Set Automatically. If the option is greyed out, a device management profile is controlling it.
Linux
Run timedatectl set-ntp true, then check with timedatectl status that System clock synchronized reads yes.
Google Authenticator on Android
The app can correct itself without touching the system clock: open it, tap the three-dot menu → Settings → Time correction for codes → Sync now. This only affects the app.
If the clock is fine and codes still fail
Work through these in order:
- The code expired. Thirty seconds is short. If you copy at second 28 and paste at second 33, you submitted a dead code. Wait for a fresh one.
- Wrong account. Authenticator apps show several similar six-digit numbers. Check the label, not just the digits.
- Mistyped secret key. Base32 excludes 0, 1 and 8 precisely because they look like O, I and B. Re-check the key, or read it straight out of the QR with our QR code decoder.
- Non-default settings. A handful of services use 8 digits or a 60-second period. A generator using the defaults will be consistently wrong.
- Rate limiting. After several failures some services reject even correct codes for a few minutes. Wait, then try once.
The longer version, with the less obvious causes, is in why your 2FA codes keep getting rejected.
Frequently asked questions
How far off can my clock be before codes stop working?
Under about 30 seconds you are usually fine, because most servers accept the neighbouring window as well as the current one. Beyond roughly a minute, codes will fail every time. Between those two points behaviour is unpredictable, which is worse than an outright failure because it looks like a random fault.
Does this tool change my clock?
No. It only measures. Correcting the clock is an operating system setting, and the steps for each platform are above.
What is it comparing against?
The Date header our own web server returns, corrected for half the measured round-trip time and taken as the median of five samples. It is not an atomic reference, but it is accurate to about a second — far more precision than TOTP needs.
My time zone is wrong. Does that matter?
Not for TOTP. Codes are calculated from UTC, so a device in the wrong time zone but with the correct underlying clock still produces valid codes. Only the absolute time matters, which is also why authenticator codes keep working when you fly between countries — see 2FA while travelling.
Related tools and guides
- 2FA Live Code Generator — paste a secret key, get the six digits.
- QR Code to 2FA Secret Key — read the key out of a setup QR.
- 2FA QR Code Generator — turn a key back into a scannable QR.
- What is a TOTP code?
- 2FA backup codes and where to keep them