OTP Generator
Generate time-based TOTP or counter-based HOTP verification codes from a Base32 secret using HMAC-SHA1.
Run tool
This online tool generates standard one-time passwords using HMAC-SHA1 authentication algorithms. You can produce time-based verification codes or counter-based event tokens directly from a Base32 secret key. For time-based authentication, the tool evaluates the current Unix timestamp against your chosen renewal interval and calculates the exact seconds remaining before expiration. For counter-based authentication, the system increments an integer event counter independent of system clocks.
Configure your security preferences by choosing between six-digit or eight-digit outputs. The standard time interval defaults to thirty seconds, but you can adjust it to any whole integer up to 86,400 seconds. For event-driven verification, input any counter value from zero up to the maximum 64-bit integer limit. The generator handles standard Base32 secret strings, normalizing casing and stripping surrounding whitespace automatically. Use this interface to test two-factor authentication setups, verify authenticator compatibility, or diagnose token synchronization issues quickly.
Instructions
- Enter your Base32 shared secret key into the secret field.
- Select your target mode, choosing either time-based TOTP or counter-based HOTP.
- Select the desired output length, either 6 or 8 digits.
- If using TOTP mode, set the time step interval in seconds (default is 30).
- If using HOTP mode, enter the current whole-number counter value.
- Run the generator to view the authentication code and remaining validity seconds.
Examples
- Generate a standard 6-digit TOTP code with a 30-second interval using secret JBSWY3DPEHPK3PXP to test authenticator synchronization.
- Generate an 8-digit HOTP code using counter 5 and secret GEZDGNBVGY3TQOJQ for event-based authentication verification.
FAQ
What secret formats are accepted by this generator?
The tool accepts Base32 secret strings. Surrounding whitespace is automatically ignored, letter casing is normalized, and missing Base32 equal sign padding characters are handled without error.
How does the time-based calculation determine code expiration?
TOTP mode reads the current Unix epoch timestamp, divides it by the configured interval (defaulting to 30 seconds) to determine the time step, and calculates the remaining seconds until the window ends.
What is the difference between TOTP and HOTP modes?
TOTP generates codes based on the current system clock and an expiring time window. HOTP generates codes using an incrementing counter value and operates completely independently of the clock.
What happens if a decimal or non-integer counter is entered?
The generator requires strict integer values for the digit length, period, and counter fields. Non-integer numeric values or invalid characters will prevent code generation.