One-Time Password Generator

Generate random numeric/alphanumeric OTP codes, TOTP secrets, and sequential HOTP validation codes locally in your browser. 100% private. No server calls.

Loading OTP Generator workspace...

What is an OTP & TOTP Secret Generator?

Overview and core technical concepts

An OTP (One-Time Password) Generator calculates 6-digit and 8-digit authorization tokens using RFC 6238 TOTP (Time-based) and RFC 4226 HOTP (Counter-based) algorithms from Base32 secret keys.

Generates RFC 6238 TOTP & RFC 4226 HOTP 2FA authorization tokens
Configurable time step (30s default) and digit count (6 or 8 digits)
Generates Base32 secret keys & OTPAuth QR code URLs
100% Client-side Web Crypto API execution

Why Use TOTP 2FA Tokens?

Key advantages, developer speedups, and security benefits

Test 2FA Authentication Integrations

Verify backend TOTP validation logic during application development.

Secure User Account Logins

Two-factor authentication adds a critical security layer beyond static passwords.

When Shouldn't You Hardcode TOTP Secrets?

Anti-patterns, limitations, and when to choose an alternative approach

Storing TOTP Secrets in Frontend Client Apps

TOTP secrets must remain confidential. Store master secrets securely in server databases.

TOTP Token Calculation

Sample inputs, expected outputs, and code patterns

Standard 6-Digit TOTP Token

Input
Secret: JBSWY3DPEHPK3PXP | Time Step: 30s
Expected Output
Token: 482910 (Refreshes every 30 seconds)

Common TOTP Verification Mistakes

Frequent errors, security risks, and how to fix them

Server System Clock Desynchronization
The Mistake:Running backend servers with out-of-sync system clocks.
The Impact:Causes valid client TOTP tokens to be rejected due to time drift.
How to Fix:Synchronize backend server clocks using Network Time Protocol (NTP).

Frequently Asked Questions

An One-Time Password is a dynamic authentication code valid for only a single transaction or login session. It is commonly used as a second factor in Multi-Factor Authentication (MFA). OTPs prevent credential replay attacks because even if a code is intercepted, it expires quickly and cannot be reused for future logins.

HOTP (HMAC-based One-Time Password) is counter-based. It generates a new code each time the user clicks a button or triggers a verification event. The counter increments sequentially. TOTP (Time-based One-Time Password) is a variant of HOTP that uses the current time step as the counter. The codes rotate automatically after a set period (usually 30 seconds) regardless of user interaction.

Authenticator apps (like Google Authenticator, Authy, or Microsoft Authenticator) parse a configuration URL that looks like 'otpauth://totp/Label?secret=SECRETKEY&issuer=Issuer'. This URL is typically converted into a QR code for easy scanning. However, all authenticator apps allow you to enter the raw Base32 secret key manually. Typing or pasting the secret generated here into your app will sync the codes perfectly.

Yes, because ToolZeno processes all computations and randomizations 100% client-side. No secret keys or generated OTP codes are ever sent to our servers or transmitted over the network. However, for maximum security in production, always generate credentials inside secure backend shells or dedicated offline key generation environments.

The original RFC 6238 TOTP specifications defined HMAC-SHA-1 as the default hashing algorithm. While SHA-1 is cryptographically weak for file collisions, it remains highly secure for HMAC and short-lived OTP tokens because it only generates 6-to-8 digit codes. As a result, almost all commercial authenticator apps default to SHA-1, though some modern systems support SHA-256 and SHA-512.