OTP code generator

Generate and validate time-based OTP (one time password) for multi-factor authentication.

Enable JavaScript to use the interactive tool. The guide below explains how it works.

OTP Code Generator and Validator

What it does

The OTP Code Generator and Validator is a comprehensive tool for working with One-Time Passwords (OTP). It allows you to generate and verify codes compatible with popular Two-Factor Authentication (2FA) apps like Google Authenticator, Microsoft Authenticator, and Authy. The tool supports both TOTP (Time-based One-Time Password, RFC 6238) and HOTP (HMAC-based One-Time Password, RFC 4226).

Why someone uses it

Step-by-step instructions

  1. Select Algorithm: Choose between TOTP (Time-based, most common) or HOTP (Counter-based).
  2. Generate or Enter Secret: Either click the "Generate" button to create a new random Base32 secret or paste your existing secret into the "Secret Key" field.
  3. Configure Parameters:
    • For TOTP: You can usually leave the default (30s period, SHA1).
    • For HOTP: Ensure the "Counter" value matches your current state.
  4. View Token: The 6-digit code will appear instantly. For TOTP, it will automatically refresh as time passes.
  5. Verify a Token: To check if a code is valid, enter it into the "Verify" field. The tool will check it against the current secret and time/counter.

Examples

FAQs

Common mistakes

Use cases

Related tools

All tools

Guides and articles