← All tools/Generators/Security/TOTP Code Generator

TOTP Code Generator

Generate the 6-digit two-factor codes from a Base32 secret — the same RFC 6238 algorithm behind Google Authenticator — entirely in your browser.

From your service’s 2FA setup — the text key shown next to the QR code.

sec

Current code

— — —

SHA-1 · 6 digits · changes in — s

Next code in — seconds

Next code—
AlgorithmSHA-1
Period30 seconds
RFC 6238 test vectors (computed live on this page)
Computing…

Everything runs locally in your browser. Your secret is never sent anywhere and never stored — close the tab and it is gone. Only use test secrets here; never paste a production secret into any web page.

How it works

Counter C = floor(Unix time ÷ period)      (period = 30 s)
Code = dynamic-truncate(HMAC(secret, C)) mod 10^digits
otpauth://totp/WhiteUI:demo?secret=…&issuer=WhiteUI&algorithm=SHA1&digits=6&period=30

RFC 6238 test vector: secret = ASCII “12345678901234567890”, time = 59 s → counter C = 1 → HMAC-SHA1 truncated to 8 digits = 94287082, so the 6-digit code is 287082 (the last 6 digits). At time 1111111109 s the 8-digit code is 07081804, and at 1234567890 s it is 89005924. Press “RFC test secret” above to load that secret here and check the vectors in the panel.

SHA-1 is computed with a pure-JavaScript implementation on this page; SHA-256 and SHA-512 use your browser’s built-in WebCrypto, which needs a secure (https) page. Nothing is uploaded or stored — close the tab and the secret is gone. Last updated November 2026.

Frequently asked questions

What is a TOTP code?

A time-based one-time password (RFC 6238): a short code that changes every 30 seconds, computed from a shared secret and the current time. Authenticator apps and the service you log in to compute the same code, so matching codes prove you hold the secret.

Is my secret safe here?

Yes — the code is computed locally in your browser and the secret is never uploaded or stored. Even so, only use test secrets in any web page, and never paste a production secret anywhere except your authenticator app.

Where do I find my secret?

When you turn on two-factor authentication, the service shows a QR code and a text key — that text key is the Base32 secret. Paste it here exactly as shown, ignoring spaces and dashes.

Why does my code not match my authenticator app?

Usually the clock or a setting differs: check that the period (30 s), digit count (6) and algorithm (SHA-1) match the service, and that your device clock is in sync. A code from the wrong minute never matches.

What is the otpauth:// link?

It packs the secret, issuer, algorithm, digits and period into one link, so an authenticator app can add the account from it instead of a QR code. Copy it from the panel above.

More tools

Tell us what you think

Loving this tool, or stuck on something? Tell us — it takes a minute.

We’ll only use your name and email to reply if needed. The tool and page are filled in for you.