Free TOTP Generator – 2FA Codes Online

Free TOTP and HOTP generator: get live 2FA codes from a Base32 secret, parse otpauth:// links and create new secrets with an authenticator QR code. RFC 6238.

  • No upload, 100% private
  • Instant, in your browser
  • 100% free, no signup
Loading tool…
Read the complete guideHow TOTP Two-Factor Codes Work, and Why They Sometimes Fail →

About the TOTP / 2FA Code Generator tool

Time-based one-time passwords are the six-digit codes shown by Google Authenticator, Microsoft Authenticator, Authy and password managers. Each code is an HMAC of the current 30-second time step, keyed with a shared secret that the website gave you as a QR code or a Base32 string. When developers build two-factor login, or when you need to check that a secret was copied correctly, it helps to generate those codes outside a phone.

Paste a Base32 secret, or a full otpauth:// URI, and this tool shows the current code, a countdown to the next one, and the previous and next codes so you can check clock drift. It implements RFC 6238 (TOTP) and RFC 4226 (HOTP) with the browser's Web Crypto HMAC, supports SHA-1, SHA-256 and SHA-512, 6 or 8 digits and 15, 30 or 60-second periods, and has been checked against the official RFC test vectors.

Building 2FA into your own app? Click Generate new secret to create a random key, fill in the issuer and account name, and the tool builds the otpauth:// link and a scannable QR code. Everything happens locally. Treat any real 2FA secret like a password.

How to use TOTP / 2FA Code Generator

  1. Paste a Base32 secret or an otpauth:// link into “Secret key (Base32) or otpauth:// URI”, or click “Generate new secret”.
  2. Choose TOTP or HOTP, the algorithm, the number of digits and the period (or the counter for HOTP) if they differ from the defaults.
  3. Read the current code and the countdown bar, and use “Copy code” to copy it.
  4. To set up an authenticator app, enter the issuer and account, then scan the QR code or copy the otpauth:// URI.
  5. Download the QR code as PNG or SVG with the buttons below it.

Features

RFC 6238 and RFC 4226

TOTP and HOTP codes computed with Web Crypto HMAC, matching the RFC test vectors for SHA-1, SHA-256 and SHA-512.

otpauth:// parsing

Paste a key URI and the secret, issuer, account, algorithm, digits, period and counter are filled in automatically.

Previous and next codes

See the neighbouring codes to diagnose a server or phone clock that is out of sync.

Secret and QR creation

Generates a random secret of the right size for the chosen algorithm and a QR code any authenticator app can scan.

Lenient Base32 input

Spaces, dashes, lowercase letters and padding in copied secrets are ignored.

When to use it

  • Test the two-factor login flow of an app you are developing.
  • Confirm that a TOTP secret stored in your database produces the same code as the user's phone.
  • Create the QR code and secret for a service account's 2FA setup.
  • Check whether a failed 2FA login was caused by clock drift.
  • Learn how TOTP works by changing the period, digits and algorithm.

Frequently asked questions

Is this the same code as Google Authenticator shows?

Yes, for the same secret, algorithm, digits and period. Google Authenticator uses SHA-1, 6 digits and 30 seconds by default, which are the defaults here.

Why does my code not match?

The most common cause is a clock difference. TOTP uses the current time, so check that your device clock is set automatically. Also check the algorithm, digit count and period match what the service uses.

Should I use this instead of an authenticator app?

No. For your own accounts keep the secret in an authenticator app or password manager. This tool is for developers, testing and recovery checks.

Is my secret sent anywhere?

No. The HMAC is calculated by the Web Crypto API in your browser and the QR code is drawn locally. Nothing is uploaded or saved.

What is the difference between TOTP and HOTP?

TOTP derives the counter from the time (a new code every period). HOTP uses an event counter that increases each time a code is used, so codes do not expire on their own.

Related tools