Toolvist

TOTP Code Generator

Generate time-based one-time passwords from a secret key, with a live countdown timer.

Letters A-Z and digits 2-7. Spaces and dashes are ignored.

30

seconds

—

Current code

Click to copy

Next code

otpauth:// URI

TOTP Code Generator

Generate the same time-based one-time passwords your authenticator app uses. Enter the Base32 secret you were given when setting up two-factor authentication, and this tool shows the current 6-digit code with a countdown to the next one.

TOTP codes are time-based one-time passwords; if you need a long-lived secret instead, the Random Token Generator is the right choice, and the Password Generator covers login credentials.

How to use the TOTP Generator

  1. 1 Paste the shared secret, which is usually a Base32 string from a QR code.
  2. 2 Read the current six-digit code and the countdown to the next one.
  3. 3 Enter the code before the timer expires — most services allow one step of drift.
  4. 4 Adjust the period or digit count only if your service uses non-standard values.

RFC 6238 Time-Based One-Time Password 2FA generation

The TOTP Generator computes standard 6-digit Time-Based One-Time Passwords adhering to RFC 6238 (the algorithm powering Google Authenticator, Authy, and two-factor authentication [2FA] systems worldwide). It combines a shared Base32 secret key with the current Unix epoch timestamp divided into discrete 30-second time windows.

The algorithm applies HMAC-SHA1 to the 8-byte time counter and dynamically extracts a 31-bit integer, taking the modulo 1,000,000 to produce a 6-digit verification code. The generator provides live timer countdowns showing when the current code expires, enabling rapid testing of two-factor authentication implementations.

  • Generates standard 6-digit 2FA verification codes conforming to RFC 6238.
  • Compatible with standard Base32 shared secrets used by Google Authenticator.
  • Features a synchronized 30-second interval countdown timer for code expiration.
  • Essential for developers testing 2FA login workflows and identity provider APIs.

Frequently asked questions

How does a TOTP code work?

Both sides share a secret. Each computes an HMAC of the current time step — usually the number of 30-second intervals since 1970 — and truncates the result to six digits. Because the input is the clock, both sides agree without any communication.

Why is my code rejected?

Almost always clock drift. If your device time is more than about 30 seconds out, the code belongs to a different time step and the server will not match it. Enable automatic network time on your phone or computer and the problem disappears.

Is a TOTP secret as sensitive as a password?

More so. The secret generates every future code, so anyone who has it can produce valid codes indefinitely — which is why it is shown once and stored in an authenticator app. Treat it like a password you can never change.

Related Security & Cryptography Tools

Browse all Security & Cryptography Tools →

You might also need

Tools from other categories that people pair with the TOTP Generator:

Browse the full tool directory →