UseToolSuite UseToolSuite

TOTP / 2FA Generator

Generate secure Time-based One-Time Passwords directly in your browser.

Standard 6-digit, 30-second codes Uses the browser's Web Crypto Secret never leaves your device Works offline

Encrypted 2FA Vault

Offline Protected

Vault is Locked

Enter master password to decrypt 2FA secrets.

No Tokens Visible

Unlock your vault to view or add 2FA codes.

How TOTP works

TOTP (Time-based One-Time Password, RFC 6238) turns a shared secret plus the current time into the rotating 6-digit code you know from authenticator apps. The mechanism: take the secret, take the current Unix time divided into 30-second steps, compute an HMAC of the two, and truncate the result to 6 digits. Because both you and the server share the secret and read the same clock, you both derive the same code independently — no network round-trip needed. The code changes every 30 seconds because the time-step input changes.

The inputs that must match

ParameterCommon valueNotes
SecretBase32 (A–Z, 2–7)Provided by the service
AlgorithmSHA-1Some use SHA-256/512
Digits6Occasionally 8
Period30sRarely 60s

If a code is rejected and the clock is correct, a mismatch in one of these (algorithm/digits/period) is the next thing to check — they’re all encoded in the otpauth:// URI a service gives you.

The Base32 secret

TOTP secrets are Base32 encoded (uppercase A–Z and digits 2–7 only). Characters like 0, 1, 8, 9, or lowercase letters aren’t valid Base32 and will trigger a decoding error — so if the tool rejects a secret, check you copied it exactly, without spaces or invalid characters. The otpauth://totp/...?secret=... URI bundles the secret with all the parameters above, which is what QR codes for 2FA setup actually encode.

No network, by design

To keep a zero network footprint, this tool derives time from your local device clock, not an external time server — which is exactly why clock drift (FAQ) is the main failure mode. All HMAC computation happens locally through the Web Crypto API. For the symmetric-crypto building block underneath TOTP, see the HMAC Generator.

TOTP / 2FA Generator creates what you need on the spot — no account, no sign-up, no server round-trip. It's one of the free Generator Tools on UseToolSuite. Below you'll find a step-by-step guide, answers to common questions, and related tools.

Last updated

How to Use This Tool

  1. 1

    Enter your secret

    Paste the Base32 secret key (or otpauth:// URI) the service gave you when you set up two-factor authentication.

  2. 2

    Read the current code

    The tool computes the 6-digit code for the current 30-second window, the same way an authenticator app does.

  3. 3

    Use it before it rolls

    Type the code into the site that asked for it before the countdown resets and a new code appears.

How helpful was this tool?

Click to rate

Embed this tool on your site

Paste this snippet into any HTML page or blog post to embed a live, fully working copy of TOTP / 2FA Generator. Free for any use.

Key Concepts

Essential terms and definitions related to TOTP / 2FA Generator.

TOTP

Time-based One-Time Password (RFC 6238) — the 6-digit code that changes every 30 seconds, derived from a shared secret and the current time.

Base32 secret

The key a service shows you (often behind the QR code) when enabling 2FA, written in Base32 (A–Z and 2–7). Both your app and the server hold this same secret.

otpauth:// URI

The full string encoded in a 2FA QR code. It bundles the secret plus settings like issuer, digit count, and period so an app can configure everything at once.

Frequently Asked Questions

Is this a safe place to put my 2FA secret?

The code is computed in your browser and the secret is never sent anywhere, so the maths is safe. But pasting a real 2FA secret into any website is a habit worth avoiding for important accounts — use it for testing, development, or throwaway setups, and keep production secrets in a dedicated authenticator app.

My codes are rejected even though the secret is right.

Almost always a clock problem. TOTP depends on your device time matching the server within about 30 seconds. Turn on automatic date and time in your OS settings and try again.

Why won't it accept my secret?

TOTP secrets are Base32, which only uses the letters A–Z and digits 2–7. If your string has 0, 1, 8, or 9, it was probably mistyped — check for an O read as 0, or trailing spaces from copying.

Why are my generated codes rejected?

Almost always clock drift. TOTP codes are derived from the current time in 30-second windows, so both your device and the server must agree on the time within a small tolerance. If your device's clock is off by more than ~30–60 seconds from true UTC, every code you generate will be 'wrong' from the server's perspective — even though the secret is correct. The fix: make sure your device clock is set to sync automatically (network time), not set manually. Servers typically allow a window of ±1 time-step for minor drift, but anything beyond that fails. Other causes are rarer: a mistyped Base32 secret, or the wrong algorithm/digits/period (most use SHA-1, 6 digits, 30s, but some services differ — check the otpauth URI). If the time is correct and it still fails, re-check the secret character by character.

Is it safe to type my real 2FA secret into this tool?

The computation is safe — it runs entirely in your browser via the Web Crypto API, your secret is never transmitted to any server, isn't written to localStorage, and you can verify this by using the tool offline. So technically nothing leaks. HOWEVER, for your actual production accounts, the better practice is to keep 2FA secrets in a dedicated authenticator app (Aegis, 2FAS, Google Authenticator) or a password manager, not to paste them into web tools as a routine. The reason is operational security and convenience, not a flaw here: a real authenticator keeps the secret encrypted on your device, survives across sessions, and isn't exposed on screen. Use this generator for DEVELOPMENT and TESTING — verifying a TOTP implementation, debugging an integration, or learning how the algorithm works — rather than as your everyday authenticator.

Troubleshooting & Technical Tips

Common errors developers encounter and how to resolve them.

Codes keep getting rejected by the site

Your device clock is out of sync. Enable automatic/network time in your operating system so it matches UTC within the 30-second window TOTP allows.

Invalid Base32 secret

The secret contains characters outside A–Z and 2–7, or has stray whitespace. Remove spaces and check for an "O" that should be a "0" is not the issue here — Base32 has no 0 or 1 at all, so re-copy the exact key.

Related Guides

In-depth articles covering the concepts behind TOTP / 2FA Generator.

Related Tools