Free tool

TOTP generator

Paste a Base32 secret or an otpauth:// link and get the current two-factor code, the next one and a live countdown.

Nothing leaves your browser — no network requests.

Current code

––– –––

–

Next code

––– –––

How TOTP works (RFC 6238)

When you turn on two-factor authentication, the website creates a random secret key and shows it to you as a QR code. Your authenticator stores it. From then on, both sides can compute the same code without talking to each other:

  1. Count time steps. Take the Unix time (seconds since 1 January 1970 UTC) and divide by the period, usually 30 seconds, rounding down. That number is the counter T.
  2. Sign the counter. Compute HMAC(secret, T) with SHA-1 (or SHA-256/SHA-512), with T as an 8-byte big-endian number.
  3. Truncate. Use the last 4 bits of the HMAC as an offset, read 4 bytes from there, clear the top bit, and take the result modulo 106 for 6 digits (108 for 8).

Because both sides use the clock, the code only matches if the clocks agree. Servers usually accept the previous and next window too, which gives about ±30 seconds of tolerance. That is why a phone with a wrong clock produces “invalid code” errors, and why fixing the time is the first step in every troubleshooting guide.

The otpauth:// link inside a QR code

A 2FA QR code contains a link like this:

otpauth://totp/Roblox:builderman?secret=JBSWY3DPEHPK3PXP&issuer=Roblox&algorithm=SHA1&digits=6&period=30

secret is the Base32 key, issuer and the label name the account, and algorithm, digits and period are optional (defaults: SHA1, 6, 30). Paste a link like this above and the tool reads all of it.

RFC 6238 test vectors

The standard publishes reference values so implementations can be checked. With the ASCII seed 12345678901234567890 (Base32 GEZDGNBVGY3TQOJQGEZDGNBVGY3TQOJQ), SHA-1, 8 digits and a 30-second period, the code at Unix time 59 is 94287082. Run all 18 vectors from Appendix B in your browser:

Unix timeSHA-1SHA-256SHA-512

Expected values from RFC 6238, Appendix B. Results appear after you run the check.

Questions

Is it safe to paste my secret key here?

This page runs entirely in your browser and is served with a Content Security Policy that blocks all network requests from scripts (connect-src 'none'). You can confirm it in your browser’s developer tools. Still, a secret key is the whole account factor: for real accounts, prefer adding it straight to an authenticator app and only use this tool for testing.

Why does my code not match the one on the website?

Check the algorithm, digits and period: most services use SHA-1, 6 digits and 30 seconds, but some use 8 digits or SHA-256. An otpauth:// link sets these automatically. Then check your computer’s clock is set automatically.

What is the difference between TOTP and HOTP?

TOTP (RFC 6238) uses the current time as the counter, so codes change every 30 or 60 seconds. HOTP (RFC 4226) uses a counter that increases each time you request a code. Almost every website today uses TOTP.

Can this generate Steam Guard codes?

No. Steam Guard uses its own 5-character format and only issues keys to the Steam Mobile app.

What is a Base32 secret?

The text version of the key inside a 2FA QR code, using letters A–Z and digits 2–7, often shown in groups of four like JBSW Y3DP EHPK 3PXP. Spaces and lowercase do not matter.

Keep real codes on your iPhone

2FA Setup generates the same codes as this tool, stores the secret in the iOS Keychain, locks with Face ID and works offline. Free for 5 accounts, $49.99 once for unlimited.