Skip to main content

TOTP Generator

Enter a Base32 secret key to generate real-time TOTP codes — the same algorithm used by Google Authenticator, Authy, and all RFC 6238 authenticator apps. Shows a live countdown ring, the current 6-digit code, and a preview of the next code. Uses the Web Crypto API (crypto.subtle) — your secret never leaves your browser.

✓ RFC 6238 TOTP (Google Authenticator compatible) ✓ Live countdown + next code preview ✓ Secret stays in browser — never transmitted

Frequently Asked Questions

What is TOTP and how does 2FA work?▼

TOTP (Time-based One-Time Password, RFC 6238) is the algorithm behind most 2FA/MFA apps including Google Authenticator, Authy, and Microsoft Authenticator. It works by combining a shared secret key with the current Unix timestamp (divided into 30-second windows) using HMAC-SHA1 to produce a 6-digit code. Because both your device and the server independently compute the code from the same secret and timestamp, they generate matching codes without any communication — making interception pointless since codes expire in 30 seconds.

Where do I find my TOTP secret key?▼

When enabling 2FA on a service, you're usually shown a QR code. Most services also offer a 'Can't scan? Enter manually' option that reveals the raw Base32 secret — a string of letters A-Z and digits 2-7, usually 16–32 characters (e.g., JBSWY3DPEHPK3PXP). Copy this and paste it here. You can also extract the secret from a QR code using a QR scanner app — the URL format is: otpauth://totp/Account?secret=YOURSECRET&issuer=Service

Is this compatible with Google Authenticator and Authy?▼

Yes. This tool implements the standard TOTP algorithm: RFC 6238, HMAC-SHA1, 6-digit output, 30-second time window. This is identical to Google Authenticator, Authy, Microsoft Authenticator, 1Password TOTP, Bitwarden Authenticator, and virtually all TOTP-compatible apps. If you enter the same secret, you'll get the same code as your authenticator app (within the same 30-second window).

Is my secret key sent to a server?▼

No. All computation happens entirely in your browser using the Web Crypto API (crypto.subtle.importKey and crypto.subtle.sign for HMAC-SHA1). Your secret key is never transmitted to any server or stored in any database. This tool also works offline once the page is loaded.

Why does the code change every 30 seconds?▼

The counter value fed to HMAC is floor(UnixTimestamp / 30) — it advances by 1 every 30 seconds. Each counter value produces a unique 6-digit code. The countdown timer shows how many seconds remain in the current 30-second window. The 'next code' preview shows the code for the upcoming window so you can avoid entering a code that will expire in 1-2 seconds.

What do I do if my TOTP codes don't match my authenticator app?▼

TOTP codes are time-sensitive — if your device clock is off by more than 30 seconds, codes will be wrong. (1) Sync your device clock with an NTP server. On Android: Settings → Date & Time → Sync. On iOS: Settings → General → Date & Time → Set Automatically. (2) Double-check that you're using the correct Base32 secret — even one wrong character produces completely different codes. (3) Make sure the service uses standard TOTP (30-second period, SHA1) — some use SHA256 or 60-second windows (uncommon).

Share this tool: X / Twitter LinkedIn
✓ 60,000+ developers use DevPlaybook ★★★★★ 4.8 / 5 on Gumroad ✓ MIT licensed · Instant download ✓ No login required

Related Products

on Gumroad

You Might Also Need

More Free Tools

Enjoying this tool? Get more like it.

Weekly developer tool guides, productivity playbooks & AI tricks. Free. No spam.

DevPlaybook Pro 7 days free

Unlock AI-Powered Dev Tools

  • ⚡ AI Code Review, Doc Generator & SQL Builder
  • ⚡ All premium templates & early access
  • ⚡ Member discounts on Gumroad products
Start Free Trial →

$9/mo after trial · Cancel anytime

Want the full toolkit?

Get DevPlaybook Pro

Every template, guide, boilerplate, and automation script in one bundle. 13 premium products — grab them all at once and save big.

$79
$241 separately Save $162 (67% off)
Get DevPlaybook Pro — $79 →

MIT licensed · Instant download · No subscription

See what's included → Browse all deals →