OTP code generator — Guide
Generate and validate time-based OTP (one time password) for multi-factor authentication.
What it is and when to use it
Generate and validate time-based one-time passwords (TOTP) from a base32 secret — the same mechanism behind Google Authenticator-style codes. Useful for testing your own MFA implementation, decoding a setup key before scanning it into an app, or verifying that a code is currently valid.
Generates and verifies time-based one-time passwords (TOTP) for two-factor authentication setups.
How to use it
- Enter the secret (Base32)
- Click generate to get the current code
- To verify, enter the code the other party provided and compare
A worked example
Things that trip people up
- TOTP depends on the device clock — too large a time difference makes codes fail to match indefinitely
Questions people ask
- How does the 6-digit code get calculated?
- The secret plus the current time (in 30-second steps) go through HMAC, and a slice of the result becomes the code. Same secret + same time window = same code, which is why phone and server agree.
- Why did my code stop matching?
- Clock drift. TOTP depends on the device clock — too large a difference from the server makes codes fail indefinitely. Re-sync the device time or re-enrol the secret.
- Is the base32 secret sensitive?
- Completely — anyone holding it can generate your codes forever. Store it like a password, and enrol it in an authenticator app rather than pasting it around.
Next steps
Open the OTP code generator tool
- UUID Generator
- ULID Generator
- Nano ID Generator
- Token Generator
- Password Generator
- BIP39 passphrase generator
Spotted something wrong on this page? Tell us via Contact Us