TOTP 2FA Generator
Generate Time-based One-Time Passwords (TOTP) for two-factor authentication testing with our free online TOTP/2FA Generator. Whether you are a developer implementing 2FA in your application, a QA engineer verifying TOTP workflows, or a security professional testing authentication systems, this tool provides quick access to TOTP codes and secrets. Generate TOTP secrets in Base32 format, create authenticator-compatible QR codes, and produce time-based codes that match Google Authenticator, Authy, Microsoft Authenticator, and other standard TOTP apps. Set custom parameters including algorithm (SHA-1, SHA-256, SHA-512), digit length, and time period. All generation happens locally in your browser — your secrets never leave your device.
What Is
A TOTP (Time-based One-Time Password) Generator is a tool that creates temporary, time-sensitive authentication codes used in two-factor authentication (2FA) systems. TOTP is defined in RFC 6238 and is the algorithm behind popular authenticator apps like Google Authenticator, Authy, Microsoft Authenticator, and Duo. The algorithm works by combining a shared secret key with the current Unix time to produce a short numeric code that changes every 30 seconds. Because the code depends on both the secret and the current time, it cannot be reused after expiration and cannot be predicted without knowing the secret. Our free online TOTP/2FA Generator lets you create Base32-encoded secret keys compatible with all standard authenticator apps, generate QR codes for easy setup in mobile authenticator applications, and produce time-based codes using configurable parameters (SHA-1, SHA-256, or SHA-512 hash algorithms, 6 or 8 digit codes, and custom time periods). All cryptographic operations run locally in your browser using the Web Crypto API, so secret keys are never transmitted over the internet. This makes the tool ideal for testing 2FA implementations, simulating authenticator behavior, and educating users about TOTP mechanics.
How to Use
- Generate a new Base32-encoded secret key by clicking the generate button, or enter your own existing secret key if you need to test a specific configuration.
- Optionally customize the TOTP parameters including hash algorithm (SHA-1, SHA-256, or SHA-512), number of digits (6 or 8), and time period in seconds.
- View the current TOTP code that updates automatically every time period. The code matches what would appear in authenticator apps using the same secret and parameters.
- Scan the generated QR code with your mobile authenticator app to set up 2FA for testing purposes, or manually enter the secret key into your authenticator.
- Use the time remaining indicator to see when the current code will expire and a new one will be generated, verifying that your TOTP implementation handles time-based rotation correctly.
Examples
Input: Secret: JBSWY3DPEHPK3PXP, Time: now
Process: Decode Base32 secret → Get current 30s window counter → HMAC-SHA1 → trunc
Result: Current code: 483529 (valid for 18 more seconds)
Input: Verify: user enters 483529, window: ±1
Process: Calculate counter for prev/current/next window → Compare codes
Result: ✓ Valid (matches current window counter)
Related Searches
People also search for: totp, 2fa, authenticator, code, totp 2fa generator, free online.
totp2faauthenticatorcodetotp 2fa generatorfree onlinebrowser toolno signup
Frequently Asked Questions
What is TOTP and how does 2FA work?
TOTP (Time-based One-Time Password) is an algorithm that generates temporary authentication codes based on a shared secret and the current time. In a typical 2FA setup, the server and the user's authenticator app both store the same secret key. Every 30 seconds, a new 6-digit code is generated from the secret and the current Unix timestamp. During login, the user enters this code and the server verifies it by generating the same code independently. This adds a second layer of security beyond passwords because an attacker would need both the password and physical access to the authenticator device to log in.
Can I use the generated secret with Google Authenticator?
Yes, absolutely. The secret keys generated by this tool are Base32-encoded and fully compatible with Google Authenticator, Authy, Microsoft Authenticator, Duo Mobile, and any other authenticator app that supports the TOTP standard (RFC 6238). You can either scan the QR code directly in your authenticator app or manually enter the Base32 secret key. The codes generated by our tool will match your authenticator app exactly when using the same secret and parameters.
How are TOTP codes calculated?
TOTP codes are calculated using the HMAC-based One-Time Password (HOTP) algorithm with the current time as the counter value. Specifically, the Unix timestamp is divided by the time period (usually 30 seconds) to produce a counter. The shared secret key is then used with HMAC-SHA1 (or SHA-256/SHA-512) to generate a hash, which is dynamically truncated to produce a 6 or 8 digit code. The entire process is deterministic — given the same secret and the same time, any TOTP implementation will produce the identical code, which is what makes the system work across different apps and servers.
Is it safe to generate TOTP secrets in a browser?
For testing and educational purposes, yes. Our TOTP generator performs all cryptographic operations locally in your browser using the Web Crypto API. Secret keys are never transmitted to any server, stored in any database, or logged in any way. You can verify this by checking your browser's network tab while using the tool. However, for production use, you should generate your actual 2FA secrets using your server's secure key generation infrastructure or your authenticator app directly, as browser-based generation may not provide the same level of entropy and security as dedicated cryptographic hardware.
Why is my TOTP code not matching my authenticator app?
The most common reason for TOTP code mismatches is clock synchronization between the server and the authenticator device. TOTP algorithms rely on both parties having synchronized Unix time — even a few seconds of drift can cause mismatches because the code changes every 30 seconds. Other possible causes include using the wrong secret key, different hash algorithms (SHA-1 vs SHA-256), different digit lengths (6 vs 8), or different time periods. Ensure both your TOTP generator and authenticator app use identical parameters and that your device clock is accurate. Most authenticator apps automatically synchronize time using NTP servers.