Skip to content

Menu

TOTP Generator

Generate Time-based One-Time Passwords

Runs entirely in your browserAuth & SecurityFree, no sign-up
Loading tool

01What is TOTP Generator?

Two-factor login is annoying to test when every code has to come from a phone. This tool gives you the code in the browser instead. Paste a Base32 secret, or press Generate for a fresh one, and you see the current six-digit code. A countdown ring shows the seconds left in the window and turns orange at ten seconds and red at five. Under the hood it follows RFC 6238 with the settings most authenticator apps use. The Unix time is divided by a 30-second step to get a counter. That counter, as eight big-endian bytes, is signed with HMAC-SHA1 through the Web Crypto API. The RFC 4226 dynamic truncation then picks four bytes and reduces them to six digits. The secret field uppercases what you type and strips characters outside A-Z, 2-7, = and spaces. Spaces and padding are ignored when decoding. Generated secrets are 20 random bytes from crypto.getRandomValues, encoded as 32 Base32 characters. That matches the 160-bit secret RFC 4226 recommends for SHA-1. Here is a worked example you can check yourself. RFC 6238 Appendix B uses the ASCII secret 12345678901234567890, which is GEZDGNBVGY3TQOJQGEZDGNBVGY3TQOJQ in Base32. At Unix time 59 the counter is 1 and the RFC lists the eight-digit code 94287082. This tool keeps the last six digits, 287082. At time 1234567890 the code is 005924, and yes, the leading zeros are kept. The Verify Code section checks a six-digit code against the current window and one window either side. That is the same plus or minus 30 seconds of slack many servers allow for clock drift. It reports Valid Code or Invalid Code. The display refreshes as soon as a new window starts, even when the browser has slowed timers in a background tab. Everything runs locally and the secret is never sent anywhere. The limits are simple. The tool always uses SHA-1, six digits and 30 seconds. It does not read otpauth:// URIs or QR codes, and it always uses your device clock. You cannot type a custom timestamp, so the RFC examples above come from running the same algorithm at fixed times. If a service uses SHA-256, eight digits or a 60-second period, its codes will not match here.

Backend and QA engineers use it to produce and check TOTP codes while building or testing two-factor login. The tool runs entirely in your browser, so your data never leaves your device.

02How to use TOTP Generator

  1. Paste a Base32 secret into Secret Key (Base32), or click Generate to create a new 32-character one.
  2. Read the current six-digit code and watch the countdown ring for the seconds left.
  3. Click Copy Code to use the code, or Copy Secret to save the key somewhere safe.
  4. To check a code from another device or your server, type it into Verify Code and click Verify.
  5. Read Valid Code or Invalid Code. A valid result means it matched the current window or one either side.

03Worked examples

Input: Secret GEZDGNBVGY3TQOJQGEZDGNBVGY3TQOJQ at Unix time 59
Result: 287082
RFC 6238 Appendix B SHA-1 vector. The RFC lists 94287082 for eight digits; the tool's six-digit truncation keeps 287082. Computed with node:crypto HMAC-SHA1 using the same steps as the tool, since the page always uses the current time.
Input: Secret GEZDGNBVGY3TQOJQGEZDGNBVGY3TQOJQ at Unix time 1111111109
Result: 081804
Counter 37037036. Matches the RFC 6238 vector 07081804 cut to six digits.
Input: Secret GEZDGNBVGY3TQOJQGEZDGNBVGY3TQOJQ at Unix time 1234567890
Result: 005924
Leading zeros are padded back, so the code is always six characters. RFC value 89005924.
Input: Secret GEZDGNBVGY3TQOJQGEZDGNBVGY3TQOJQ at Unix time 1111111110
Result: 050471
One second later than the earlier example, but a new 30-second window (counter 37037037), so the code changes completely.
Input: Secret typed as: gezd gnbv gy3t qojq gezd gnbv gy3t qojq (Unix time 59)
Result: 287082
Lowercase is uppercased and spaces are ignored, so grouped secrets give the same code.

04Common use cases

  • Logging into a staging app with 2FA enabled without reaching for your phone
  • Checking that a backend TOTP library agrees with a known-good generator for the same secret
  • Debugging rejected authenticator codes by comparing this tool's code with what your server expects right now
  • Creating a throwaway secret for a test account in an end-to-end test suite
  • Showing a teammate why a code from the previous window still passes on a server that allows one step of drift
  • Checking that a secret copied from an enrollment page decodes as valid Base32 before you store it

05Tips

  • If codes never match, check clocks first. A device even a minute off falls outside the one-window tolerance.
  • Many sites show the secret in groups of four with spaces. You can paste it as is, since spaces are ignored.
  • An Invalid Base32 characters warning often means a 0, 1 or 8 slipped in. Base32 uses only A-Z and 2-7, so 0 is usually O.
  • Services using SHA-256, eight digits or 60-second periods will not match here. Check the algorithm, digits and period parameters in their otpauth URI.
  • Only use real account secrets with care. A TOTP secret is as sensitive as a password, so prefer test accounts.

06Related concepts

TOTP, RFC 6238, HOTP, HMAC-SHA1, two-factor authentication, Base32.

Frequently Asked Questions

What is TOTP Generator?

TOTP Generator is a free, browser-based developer tool on AIDToolStack. Generate Time-based One-Time Passwords It requires no installation or sign-up and works entirely in your browser.

Is TOTP Generator free to use?

Yes. No sign-up, no fees and no usage cap.

Does TOTP Generator store my data?

No. It runs in your browser; nothing is uploaded.

Reviews and commentsShow

Reviews

Sign in to leave a review.

Loading reviews…

Comments

Sign in to leave a comment.

Loading comments…

What changed in AI dev tools, once a month

Renames, shutdowns, pricing changes and new MCP setups, each with a source.

Subscribe