ZapKit

2FA Code Generator (TOTP)

Paste a two-factor secret key or otpauth link and see the current six-digit code, the next one and how long until it changes.

What is a TOTP code?

A time-based one-time password (TOTP) is the six-digit code authenticator apps like Google Authenticator, Microsoft Authenticator and Authy show for two-factor login. It changes every 30 seconds and is generated from a secret shared once, when you scan the setup QR code.

Developers use a TOTP generator to test 2FA in their own apps, QA testers to log in to staging accounts, and IT admins to verify a secret was recorded correctly. This tool accepts a Base32 secret or a full otpauth link, supports 6 and 8 digits, 30 and 60-second periods and SHA-1, SHA-256 and SHA-512.

How to use the 2FA Code Generator (TOTP)

  1. 1.Paste the secret

    The setup key a site shows next to its 2FA QR code, or the full otpauth:// link.

  2. 2.Check the settings

    Most services use 6 digits, 30 seconds and SHA-1; links fill these in.

  3. 3.Read the code

    It refreshes automatically, with the next code shown too.

Example: the RFC 6238 test vector

The standard test secret 12345678901234567890 with 8 digits at 59 seconds past the Unix epoch:

SHA-1
94287082
SHA-256 (32-byte secret)
46119246
SHA-512 (64-byte secret)
90693936

The generator reproduces the official codes exactly, so it matches any standard authenticator app.

How the codes are made

TOTP, defined in RFC 6238, combines a shared secret with the current time. Every 30 seconds the time step changes, an HMAC of the step is computed with the secret, and a few digits are extracted. Any app with the same secret and an accurate clock produces the same code.

This page runs the calculation with the Web Crypto API and has been checked against the RFC's official test vectors. Use it for testing your own 2FA setup or as a developer tool; for real accounts, keep secrets in an authenticator app on a device you control.

Frequently asked questions

Why doesn't my code match?

Usually the device clock is off by more than a few seconds, or the digits, period or algorithm differ from the service's.

Is it safe to paste my secret here?

The secret stays in your browser, but anyone who sees it can make your codes. Only use real secrets on a trusted device.

Where do I find the secret key?

When enabling 2FA, choose "can't scan the QR code?" to reveal the text key.

Does it support Google Authenticator links?

Yes. otpauth://totp links with issuer, digits, period and algorithm are read automatically.

More Developer tools