Skip to main content

TOTP Code Generator

Enter a Base32 secret key and generate real-time TOTP codes — exactly like Google Authenticator. Shows a live countdown timer, 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 compliant ✓ Live countdown + next code preview ✓ Secret stays in browser

Frequently Asked Questions

What is TOTP and how does it work?▼

TOTP (Time-based One-Time Password) is defined in RFC 6238. It combines a shared secret key with the current Unix timestamp (divided into 30-second windows) and runs them through HMAC-SHA1 to produce a 6-digit code. Because both your app and the server share the same secret and use the same clock, they independently generate the same code at the same time.

What is a Base32 secret key?▼

When you set up 2FA in an app, the service gives you a secret key encoded in Base32 — the letters A-Z plus digits 2-7. This key is usually shown as a QR code, but most services also show the raw text version for manual entry. It looks like JBSWY3DPEHPK3PXP.

Is this compatible with Google Authenticator?▼

Yes. This tool implements the same TOTP algorithm (RFC 6238, HMAC-SHA1, 6 digits, 30-second period) that Google Authenticator, Authy, Microsoft Authenticator, and 1Password TOTP use.

Is my secret key sent anywhere?▼

No. All computation happens in your browser using the Web Crypto API (crypto.subtle). Your secret key is never transmitted to any server.

Why does the code change every 30 seconds?▼

The code is derived from the current time window (floor(Unix time / 30)). Every 30 seconds, the window advances and a new counter value produces a new code. This time-bound nature means stolen codes become useless almost immediately.

What does the countdown timer show?▼

The ring shows how many seconds are left in the current 30-second window. When it reaches 0, the code regenerates automatically. The 'Next code' preview shows what the next code will be so you can avoid entering a code that will expire in 1-2 seconds.

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 →