The TOTP Token Generator produces time-based one-time passwords from a base32 secret using the exact algorithm defined in RFC 6238, all inside your browser. It is built for developers verifying a 2FA implementation, QA engineers reproducing login flows, and anyone who needs an offline authenticator code without installing an app. Because the calculation uses the Web Crypto API locally, the secret never leaves your device.
How it works
TOTP is HOTP (RFC 4226) with a time-derived counter. The steps the tool performs are:
- Decode the secret from base32 (alphabet
A-Z2-7) into raw bytes. - Compute the counter as
T = floor(unixSeconds / period), then encode it as an 8-byte big-endian value. - HMAC-SHA1 the counter using the secret as the key, via
crypto.subtle.sign. - Dynamically truncate the 20-byte MAC: the low nibble of the last byte gives an offset; read 4 bytes there, mask the top bit, take the result modulo
10^digits, and zero-pad to the chosen length.
The countdown bar shows how long the current window lasts, and the previous and next codes correspond to T-1 and T+1.
Tips and example
A common test secret is JBSWY3DPEHPK3PXP, which decodes to the ASCII string Hello!\xde\xad\xbe\xef. Paste it with a 30-second period and 6 digits to see a code that matches reference TOTP libraries.
If your server rejects a code that looks correct, check three things: the period (30 versus 60 seconds), the digit count, and clock skew. The previous/next codes shown here are exactly what a skew-tolerant server would also accept, so they are the fastest way to confirm whether a mismatch is a timing issue rather than a secret-decoding bug.