TOTP Code Generator & Tester
TOTP Code Generator & Tester is a local diagnostic tool for time-based one-time passwords, the six- or eight-digit codes used for two-factor authentication.
Enter a Base32 secret, pick the algorithm, digits and period, then start to see the current TOTP code and its countdown.
This tool is intended for testing and troubleshooting TOTP configurations. Do not use it as your primary authenticator or as a place to store important 2FA secrets.
Anyone who has the same TOTP secret can generate the same codes.
Codes depend on your device's current clock. This tool does not sync time.
How to use it
- Paste your Base32 TOTP secret (use Show secret to check it)
- Choose the algorithm (SHA-1, SHA-256 or SHA-512), the digits (6 or 8) and the period (30 or 60 seconds)
- Click Start TOTP to see the current code and the countdown
- Copy the code; it refreshes automatically at the end of each period. Use Stop or Clear when done
It implements RFC 6238 (TOTP) on top of RFC 4226 (HOTP): you paste a Base32 secret, choose the hash algorithm (SHA-1, SHA-256, or SHA-512), the number of digits (6 or 8), and the period (30 or 60 seconds), and the tool shows the current code together with a countdown to the next one. SHA-1 is offered because RFC 6238 still references it widely for TOTP compatibility, not as a general hashing recommendation. Each code is derived by taking an HMAC of the current time counter — floor(unix time / period) — with your secret, then applying the RFC 4226 dynamic-truncation step. The codes are computed entirely in your browser using the Web Crypto API and your device's own clock; the tool does not synchronise time, so a code can differ from your authenticator app if the two clocks disagree. This tool is for testing and troubleshooting TOTP configurations. It is not a replacement for an authenticator app, not a backup for your 2FA secrets, and not a place to store account credentials: the secret lives only in the page while it is open and is never uploaded, logged, or stored. Anyone who holds the same TOTP secret can generate the same codes, so treat the secret with care. Unlike the HMAC Generator, which returns a single static keyed authenticator for a message, the Secure Token Generator, which produces random bytes, the JWT Decoder, which inspects an existing token, or the Password and Passphrase generators, which create new credentials, this tool turns a shared time-based secret into the changing numeric code expected by a 2FA verifier.
FAQ
TOTP, a time-based one-time password defined by RFC 6238, turns a shared secret and the current time into a short numeric code that changes at a fixed interval, commonly used as a second authentication factor.
The code is an HMAC of a counter equal to the current time divided by the period. When the clock crosses the next period boundary the counter increases, so a new code is produced.
Usually a clock difference between the two devices, or different settings. Check that the algorithm, digit count, period and Base32 secret all match, and that both clocks are accurate.
Yes. Most authenticator apps and services default to HMAC-SHA-1 for TOTP, and RFC 6238 still references it. It is offered here for that compatibility, not as a general hashing choice.
No. The secret is used only in your browser to compute codes with the Web Crypto API. It is never sent to a server, written to storage, or logged, and closing the tab discards it.