2FA / TOTP Code Generator
Generate TOTP/2FA verification codes from a Base32 secret using RFC 6238. Time-based one-time passwords computed locally in your browser.
How to Use
- Paste or type your text into the 2FA / TOTP Code Generator input area above.
- Configure any format or mode options to generate the result in real time.
- Review the generated output in the result panel above, or click Reset to start over.
What is 2FA / TOTP Code Generator?
A 2FA / TOTP Code Generator computes 6-digit Time-Based One-Time Passwords (RFC 6238) directly from a Base32-encoded shared secret inside your browser. Developers, QA testers, and security administrators use it to verify authenticator secrets during MFA integration or recover backup codes privately without syncing secrets to third-party cloud authenticators.
How It Works
Clicking Generate TOTP Code strips spaces and `=` padding from your Base32 (`A–Z`, `2–7`) secret, decodes it to raw bytes, and computes the 30-second time step `Math.floor(Date.now() / 1000 / 30)` as an 8-byte big-endian `DataView`. Using Web Crypto (`crypto.subtle.importKey` + `crypto.subtle.sign` with HMAC-SHA1), it performs RFC 4226 dynamic truncation modulo `1,000,000` locally and shows remaining seconds in the current 30s window.
Common Use Cases
- Testing 2FA enrollment flows — verify server-side TOTP verification against RFC 6238 6-digit codes using test Base32 secrets
- Air-gapped secret inspection — check a backup `JBSWY3DPEHPK3PXP`-style seed locally without installing a phone app
- Debugging time-drift issues — inspect both the generated 6-digit OTP and remaining seconds (`Valid for Xs`) in the 30s window
- QA automation validation — cross-check custom HMAC-SHA1 TOTP implementations against Web Crypto output
Technical Details
Execution: 100% browser-local RFC 6238 / RFC 4226 TOTP using `crypto.subtle` (`HMAC` with `SHA-1`), 30-second time step (`Date.now() / 1000 / 30`), Base32 (`A–Z`, `2–7`) decoder, and 6-digit zero-padded output (`% 10^6`).
FAQ
Is this 2FA / TOTP Code Generator free?
Yes, completely free. No signup required.
Does this tool upload my data?
No. All processing happens locally in your browser. Your data never leaves your device.