TOTP Generator & Verifier
Free TOTP generator and verifier — generate a Base32 secret, see the live six-digit code with its countdown, scan the enrolment QR, and verify codes with clock-drift tolerance. Runs locally in WebAssembly; nothing is uploaded.
Verify a code
Checked against the secret above, allowing one step either side — the same tolerance a server uses for clock drift.
Runs entirely in your browser — nothing you enter is uploaded or stored.
How time-based one-time passwords work
TOTP is HOTP with the counter replaced by a clock. Divide Unix time by the period — usually 30 seconds — to get a step number, compute HMAC(secret, step), take a few bytes from a position determined by the last nibble of the result, and reduce them modulo 10⁶. Both sides do this independently and compare digits.
Nothing is transmitted
That is the elegant part. Enrolment sends the secret once, via the QR code; after that, no message ever passes between your authenticator and the server. The app has no network permission requirement for a reason. It also means the only shared state is the clock, which is why drift is the failure mode people actually hit.
The secret is the credential
A code is worthless thirty seconds later; the secret behind it is worth exactly as much as the account, forever. This is why enrolment QR codes should not be photographed and left in a camera roll, and why a service that can show you your TOTP secret again after setup has stored it in a form that a breach would expose.
Frequently asked questions
What is TOTP and how does the code get generated?
A time-based one-time password is an HMAC of the current 30-second time step, keyed by a secret you and the server both hold, truncated to six digits. No message passes between you when you log in — both sides compute the same number from the same clock and the same secret, which is why it works offline and why clock skew breaks it.
Why does my code get rejected even though it looks right?
Almost always clock drift. If your device is more than a step or two away from the server, you compute a different time step and therefore a different code. Servers usually accept one step either side to absorb this. Fix the device clock rather than widening the window.
Why is SHA-1 the default when it is broken?
Because HMAC-SHA1 is not affected by the collision attacks that broke SHA-1 for signatures, and because almost every authenticator app only implements SHA-1. Choosing SHA-256 here is cryptographically fine and will silently fail to enrol in several popular apps, which is a worse outcome than the theoretical concern it addresses.
Is it safe to put a real secret into this page?
The computation is local — a WebAssembly module, no request, no endpoint that could receive one. But a TOTP secret is a permanent credential, not a one-time code: anyone holding it can generate valid codes forever. Use this tool to understand the mechanism, to test an implementation, or with a throwaway secret. Enrol real accounts through the service and your authenticator app.