TOTP Generator (2FA Code Generator)

Developer Tools

Enter a Base32 secret or an otpauth:// URI and see the current 2FA code with a countdown, for testing apps you build.

For testing two-factor sign-in in apps you build. Keep real account secrets in an authenticator app, not in a web page.
Options
Secret keyBase32, A–Z and 2–7
Or paste an otpauth:// URI
Current code

––– –––

Enter a secret or generate one

Codes are computed in your browser with Web Crypto. The secret is never sent, stored or logged. Privacy

About

What the TOTP Generator does

The TOTP Generator produces the same six- or eight-digit codes as an authenticator app, from a Base32 secret or an otpauth:// URI, with a countdown to the next code. It follows RFC 6238 with SHA-1, SHA-256 or SHA-512 and 30- or 60-second periods, can show the previous and next codes for clock-skew testing, and can create a new random secret with its URI.

Steps

How to use it

  1. 1Paste a Base32 secret or an otpauth:// URI, or generate a test secret.
  2. 2Match the digits, period and algorithm to your app's settings.
  3. 3Enter the current code in the app you are testing before the countdown ends.

Example

A real run

Input

Secret: GEZDGNBVGY3TQOJQGEZDGNBVGY3TQOJQ (the RFC 6238 test secret, ASCII "12345678901234567890")
SHA-1 · 8 digits · 30-second period

Output

1970-01-01T00:00:59Z  94287082
2005-03-18T01:58:29Z  07081804
2009-02-13T23:31:30Z  89005924

These codes match the published RFC 6238 test vectors for SHA-1, which is how the generator was checked. A real secret produces a new code every 30 seconds.

Options

Every setting, and when to use it

Digits, period and algorithm
Most services use 6 digits, 30 seconds and SHA-1, which is what Google Authenticator and most apps assume. Change them only to match an app configured otherwise.
otpauth:// URI
The text behind a 2FA QR code. Pasting one fills in the secret, issuer, digits, period and algorithm. A generated secret gets its own URI, ready to turn into a QR code.
Previous and next codes
Shows the codes for the periods before and after the current one, to test whether your server accepts a window of codes for clock drift.

Good to know

Common problems and limits

For testing and development, not a replacement for an authenticator app holding real accounts. Codes depend on your device's clock.

This tool does not log runs: the secret and codes are never sent or saved. HOTP (counter-based) codes are not supported.

To compute the underlying keyed hash directly, use the HMAC Generator; to decode a Base32 or Base64 value, use Base64.

Audience

Who uses it

  • Developers building sign-inTest the 2FA enrolment and verification flow of your app without reaching for a phone on every attempt.
  • QA engineersGenerate codes for test accounts in automated or manual test runs, including codes from the previous or next period.
  • Support engineersCheck whether a user's code failures come from clock drift by comparing neighboring codes.

FAQ

Frequently asked

What is TOTP?

Time-based One-Time Password, defined in RFC 6238. A shared secret and the current time, in 30-second steps, go through HMAC to produce a short code. The phone app and the server compute the same code independently, so nothing is sent between them.

What is the difference between TOTP, HOTP and SMS codes?

HOTP (RFC 4226) uses a counter instead of the time, so codes do not expire on their own. TOTP adds the clock, so each code lasts about 30 seconds. SMS codes are sent by the server over the phone network, which makes them vulnerable to SIM swaps; TOTP codes never travel.

Why do my codes not work?

Usually the clock: TOTP depends on both devices having the right time, and a phone or server off by more than about 30 seconds produces different codes. Check automatic time on both. Also check that digits, period and algorithm match the service's settings.

What is the secret key in Google Authenticator?

The Base32 string encoded in the QR code you scan when you enable 2FA, often shown as text under it for manual entry. Anyone who has it can generate your codes, so treat it like a password.

Is it safe to paste a secret here?

Only paste test secrets. The secret is used by your browser alone, never sent to a server, and this tool does not save runs, but a secret for a real account belongs in an authenticator app on a device you control.

Can I create a QR code for the secret?

Copy the otpauth:// URI the page generates and turn it into a QR code with any QR generator you trust, or type the secret into the authenticator app manually.

Automation: an MCP tool totp(secret, options) → code and an n8n node are planned for this tool. Runs of this tool are never stored.

GuideEncoding vs hashing vs encryption, with examples →Encoding changes the format, hashing makes a fingerprint, encryption hides data behind a key. Worked examples with Base64, SHA-256, HMAC, TOTP and UUIDs.
Built and maintained by Radhika SinghLast updated Questions: hello@operativez.ai