TOTP Code Generator
Generate a 6-digit TOTP one-time code from a Base32 secret.
What is TOTP Code Generator
TOTP (Time-based One-Time Password) generates a 6-digit code that changes every 30 seconds from a shared secret and current time (RFC 6238), used for two-factor authentication.
🔒 Everything runs in your browser. Nothing is uploaded.
What this tool actually does with your file
- Where it runs
- In your browser, on this page
- Upload
- None — the file never leaves your device
- Offline
- Works with the network disconnected
RFC 6238, computed from a shared secret and the clock
The secret is Base32-decoded, concatenated with a counter derived from Unix time divided by the period (30 seconds by default), then HMAC-SHA1 is applied and the result is dynamically truncated to six digits. Both sides compute the same six digits from the same two inputs, which is why no network call is involved.
SHA-1 is not a weakness here. HMAC-SHA1 remains sound for this construction, and it is what every authenticator app implements — switching to SHA-256 would produce codes that Google Authenticator rejects. The algorithm is fixed by interoperability, not by preference.
Why codes are rejected when the secret is right
Clock drift is the usual cause. Servers accept the current window plus typically one before and one after, which tolerates about 90 seconds of skew. A device more than a minute off will fail intermittently, which looks like a wrong secret rather than a wrong clock.
The second cause is the secret itself. Base32 secrets are printed in four-character groups and often contain characters that look alike; dropping one group yields a shorter but structurally valid key that produces consistently wrong codes. Compare the decoded byte length against the original — 20 bytes (160 bits) is the common size.
Handling the secret
The secret is the second factor. Anyone with it can generate valid codes forever, so it deserves the same care as a password: not in screenshots, not in a ticket, not in a chat message. This page computes in the tab and transmits nothing, but the clipboard and the screen are still exposure.
If a secret may have leaked, the fix is to re-enrol the account and invalidate the old secret, not to change the password. Recovery codes are the way back in when the device is lost — store them somewhere that is not the same device.
How to use
- 1.Enter the Base32 secret
- 2.Check the period
- 3.Enter the code in the auth screen
How this compares
There are three ways to do this conversion: in the browser (this page), through a server-side converter, or with a desktop app. The useful difference is not speed — it is where your file goes and how far the free tier actually reaches.
| Aspect | This tool | Upload-based converters | Desktop software |
|---|---|---|---|
| Where the file is processed | In your browser, on this page | On the vendor's servers, after an upload | On your own machine, after installing an app |
| Account required | No | Usually — free tiers ask you to sign in before lifting a limit | No, though a licence may be needed |
| Size you can process for free | No size cap, no run limit | A few files per hour, or a ~5–10 MB cap before a paywall | Whatever your disk and RAM allow |
| Price | Free. Pro is $9/month, and only buys larger files and AI features | Usually a subscription — roughly $7–15/month as of November 2026 | A one-off licence, or a subscription |
| Works offline | Yes, once the page has loaded | No | Yes |
| Time before work starts on a 20 MB file | Immediate — there is nothing to upload | Dominated by the upload — about 16 s on a 10 Mbps uplink | Just the app launch |
| What it cannot preserve | Values are generated locally with the platform's CSPRNG, never on a server | The same — the conversion is the same maths | The same, though some desktop apps re-render styles more faithfully |
Server-side converters are genuinely better at some things: very large files, sharing results with a team, keeping a conversion history, and automating batches from a script. For the case in front of you — one file, one format change, right now — they mostly add an upload wait and a sign-up form.
Frequently asked questions
Where do I get the secret?
Use the Base32 string (A-Z, 2-7) shown when setting up two-factor authentication.
How long is a code valid?
30 seconds by default. A new code is generated automatically after that.
Is the secret uploaded?
No. HMAC-SHA1 is computed entirely in your browser.
More in Generators
On this page
- What is TOTP Code Generator
- What it does with your file
- How it actually behaves
- How to use it
- How this compares
- FAQ
Excel formula reference
29 functions with syntax, arguments and a table you can retype.
Browse the list →