Tools / TOTP / 2FA Code Generator

TOTP / 2FA Code Generator.

Generate TOTP 2FA codes from a Base32 secret or otpauth:// URI, or create a new secret and setup URI.

Runs in your browser

Ctrl/⌘ + Enter to run · Ctrl/⌘ + Shift + C to copy the result

Result
Current code
Details

About TOTP / 2FA Code Generator

This tool computes time-based one-time passwords exactly as Google Authenticator, 1Password, Authy and other apps do, following RFC 6238. Paste the Base32 secret shown under a 2FA QR code, such as JBSWY3DPEHPK3PXP, or the full otpauth://totp/ URI, and you get the current code, the previous and next codes and how many seconds the current one stays valid. Parameters inside a URI — issuer, account, algorithm, digits and period — take precedence over the form fields. Leave the secret empty to create a fresh 160-bit secret with an otpauth URI you can turn into a QR code for your own application or test account. Developers use it to check a server-side TOTP implementation against known values, to log in to a staging account shared by a team, or to debug why codes are rejected. The usual culprits are clock drift (TOTP depends on the current time, so compare the device clock with an accurate time source), a secret copied with a wrong character such as 0 instead of O or 1 instead of I (Base32 has no 0, 1, 8 or 9), and mismatched settings: most apps silently ignore SHA-256, 8 digits or a 60-second period. Codes for the previous and next window help when the server accepts one step of drift. Everything runs locally; because the page is marked sensitive, secrets are never put in the URL, history or any request. Do not keep production 2FA secrets in a browser tab longer than necessary.

How to Use

  1. Paste a Base32 secret or an otpauth:// URI, or leave the field empty to generate a new secret.
  2. Adjust the algorithm, digits and period if your service uses non-default settings.
  3. Press Run to refresh the code; the details show how long it stays valid.

Frequently Asked Questions

Why is the code different from my authenticator app?

Check that your computer clock is accurate, that the secret was copied exactly, and that the algorithm, digits and period match. Most services use SHA-1, 6 digits and 30 seconds.

Where do I find the secret?

Services show it as text next to the QR code ("can't scan?"), or inside the otpauth:// link the QR code encodes. Paste either form here.

Is the code refreshed automatically?

Press Run or change an input to compute the code for the current moment. The details show the seconds left in the current window and the next code.

Is my secret sent anywhere?

No. Codes are computed in your browser with HMAC as defined in RFC 4226 and RFC 6238. The secret is not uploaded, stored or kept in the URL.

Related Tools