TOTP Generator (2FA)
Generate TOTP 2FA codes — countdown timer with auto-refresh
Enter a Base32 secret key above to generate TOTP codes
How to Use TOTP Generator (2FA)
Enter secret
Enter your base32 secret key.
View code
See the current TOTP code with countdown.
Copy
Copy the code before it expires.
Why Choose AllTools TOTP Generator (2FA)?
- ✓ 100% free, no account needed
- ✓ HMAC-SHA1 algorithm
- ✓ 30-second time step
- ✓ 6 or 8 digit codes
- ✓ Countdown timer
- ✓ No data stored or transmitted
Why Use This Tool
- ★ All processing happens locally — passwords and keys never leave your device
- ★ No data stored or transmitted to any server
- ★ Completely free with no usage limits
- ★ No account or registration required
- ★ Uses industry-standard cryptographic algorithms
How Time-Based One-Time Passwords Work
TOTP (Time-Based One-Time Password) generates 6-8 digit codes that change every 30 seconds, providing a second factor of authentication beyond passwords. The algorithm combines a shared secret key (typically 160 bits, encoded as a base32 string like JBSWY3DPEHPK3PXP) with the current Unix timestamp divided by 30 (the time step). This value is passed through HMAC-SHA1, and a portion of the output is converted to a 6-digit number. Because both the server and your authenticator app share the same secret and use the same time reference, they independently compute the same code. Most implementations accept the current code plus one code before and after (a window of ±30 seconds) to account for clock drift between devices. The QR code you scan when setting up 2FA contains a URI like otpauth://totp/Service:user@example.com?secret=JBSWY3DPEHPK3PXP&issuer=Service — this encodes the secret key, the service name, and the account identifier. This tool generates TOTP codes and secrets locally in your browser using the Web Crypto API, compatible with Google Authenticator, Authy, and 1Password.
Implementing TOTP in Your Application
Adding TOTP-based two-factor authentication to a web application involves several steps. During enrollment: generate a random secret (20-32 bytes), encode it as base32, create an otpauth:// URI, and display it as a QR code. Store the secret securely on your server (encrypted at rest). During verification: the user submits the 6-digit code from their authenticator app, your server generates the expected code using the stored secret, and you compare them. Allow a window of ±1 step (3 codes total) to handle network latency and clock drift. Critical security considerations: always provide backup codes (typically 8-10 single-use codes) in case the user loses their authenticator device. Rate-limit verification attempts (5 attempts per minute) to prevent brute-forcing (a 6-digit code has only 1 million possibilities). Store the user's last validated timestamp to prevent replay attacks — never accept a code that was already used. The RFC 6238 standard defines the algorithm, and libraries exist for every major platform: speakeasy for Node.js, pyotp for Python, rotp for Ruby, and GoogleAuthenticator for PHP.
Related Resources
Frequently Asked Questions
Is this compatible with Google Authenticator? ▼
Is there a file size limit? ▼
Which browsers are supported? ▼
Can I use this offline? ▼
Is my data secure? ▼
Does this work on mobile? ▼
Related Articles
Free Local Password Manager — Encrypted, No Account, No Cloud
Store passwords locally in your browser with AES encryption. No account, no cloud sync, no uploads. 100% private.
How to Generate Strong Passwords — Free, Private, Browser-Based
Generate strong, random passwords in your browser. Custom length, symbols, memorable passphrases. No server, no account.
How to Generate Secure Passwords in 2026
Create strong passwords, passphrases, and PINs in your browser. Uses Web Crypto API. No data stored, no account needed.
Related Tools
OTP Generator
Generate secure OTPs — numeric, alphanumeric, or hex
Password Generator
Generate passwords, passphrases, and PINs — custom
Hash Generator MD5/SHA
Generate and compare MD5, SHA-1, SHA-256, SHA-512 hashes instantly
HMAC Generator
Generate HMAC hashes — SHA-256, SHA-512 with Web Crypto
AES Encrypt/Decrypt
Encrypt and decrypt text with AES-GCM — password-based
QR Code Generator
Generate and customize QR codes with logos and presets