01What is OTP Generator?
OTP Generator makes and checks time-based one-time passwords, the six-digit codes that authenticator apps show for two-factor login. It follows RFC 6238 (TOTP), which builds on the HOTP algorithm in RFC 4226. The settings are fixed to the defaults most apps expect: HMAC-SHA1, 6 digits and a 30-second time step. Here is what happens under the hood. You paste a Base32 secret, the same string a 2FA setup QR code carries in its secret parameter. The tool strips spaces, dashes and padding, upper-cases it, and decodes it to raw bytes. It then takes the current Unix time, divides by 30, and writes that counter as an 8-byte big-endian number. That counter is signed with HMAC-SHA1 using the Web Crypto API. The last nibble of the 20-byte result picks an offset, four bytes are read from there, the top bit is masked off, and the number is reduced modulo one million. Leading zeros are kept, so 081804 stays six characters. A quick worked example. The RFC 6238 test secret is the ASCII text 12345678901234567890, which is GEZDGNBVGY3TQOJQGEZDGNBVGY3TQOJQ in Base32. At Unix time 59 the tool's code produces 287082. That is the last six digits of the 8-digit value 94287082 published in the RFC's test table, so you can check the math yourself. Click Generate and you get a fresh secret from 20 random bytes (160 bits, the key length RFC 4226 recommends), encoded as 32 Base32 characters. The code refreshes every 30 seconds and a countdown ring shows how long the current one lasts. The Validate tab takes a secret and a code and checks it against the current step plus one step before and after. That gives roughly 90 seconds of tolerance, similar to the clock-drift allowance RFC 6238 suggests servers consider. Everything runs in your browser and the secret is not sent anywhere. Some honest limits. There are no HOTP counters, no SHA-256 or SHA-512 variants, no 8-digit codes, no custom periods and no QR code import or export. If a secret has characters outside A to Z and 2 to 7, the tool flags it as invalid Base32 and shows no code. For anything beyond the default profile, a library such as otpauth (JavaScript) or pyotp (Python) is the better fit.
Backend developers and QA engineers who build or test two-factor login and need to produce or check TOTP codes for a known secret. The tool runs entirely in your browser, so your data never leaves your device.
02How to use OTP Generator
- On the Generate tab, paste a Base32 secret into the secret field, or click Generate to create a random one
- Read the current 6-digit code; the ring counts down the seconds left in this 30-second window
- Click Copy Code to paste it into the login form you're testing, or Copy secret to keep the key
- Switch to the Validate tab and enter the Base32 secret and the 6-digit code you want to check
- Click Validate Code to see whether it matches the current, previous or next time step
03Worked examples
- Input:
Secret GEZDGNBVGY3TQOJQGEZDGNBVGY3TQOJQ at Unix time 59 - Result:
287082 - RFC 6238 SHA-1 test secret. The RFC lists 94287082 for 8 digits, and the tool's 6-digit code is its last six digits. Time fixed in a scratch run of the tool's own function.
- Input:
Same secret at Unix time 1111111109 - Result:
081804 - RFC value is 07081804. The leading zero is kept so the code stays six digits.
- Input:
Same secret at Unix time 1234567890 - Result:
005924 - RFC value is 89005924.
- Input:
Same secret at Unix time 2000000000 - Result:
279037 - RFC value is 69279037.
- Input:
gezd gnbv gy3t qojq gezd gnbv gy3t qojq at Unix time 59 - Result:
287082 - Lower case and spaces are cleaned up before decoding, so you get the same code as the upper-case secret.
- Input:
ABC1 - Result:
No code. The field shows: Invalid Base32 characters. Use only A-Z and 2-7. - The digit 1 is not in the Base32 alphabet, so decoding fails.
04Common use cases
- Getting a valid login code for a test account in your staging app without pulling out your phone
- Checking that your backend's TOTP function returns the same code as a known-good implementation for the same secret and time
- Running the RFC 6238 SHA-1 test secret through the tool to confirm your own implementation matches the published table
- Confirming that a Base32 secret copied out of a setup screen or password manager decodes cleanly before you store it
- Seeing whether a code a user typed a few seconds late would still pass with a one-step drift window
- Generating a fresh 160-bit secret to seed a fixture file for 2FA integration tests
05Tips
- Spaces, dashes and lower-case letters in a secret are fine here, since the tool cleans them before decoding. Many apps show secrets in groups of four for that reason.
- If your server and this tool disagree, check the server clock first. A drift of more than about 30 seconds is the usual cause, not the algorithm.
- A code that validates here may still fail on your server if it only accepts the current step. The Validate tab allows one step on each side.
- Your app's otpauth:// URI must say digits=6, period=30 and algorithm SHA1 (or omit them) to match this tool. Any other setting gives different codes.
- Treat TOTP secrets like passwords. Don't put them in URLs, logs or tickets, and use throwaway secrets for test accounts.
06Related concepts
RFC 6238, TOTP, HOTP, Two-factor authentication.
Frequently Asked Questions
What is OTP Generator?
OTP Generator is a free, browser-based developer tool on AIDToolStack. Generate and validate TOTP one-time passwords with countdown timer. It requires no installation or sign-up and works entirely in your browser.
Is OTP Generator free to use?
Yes. No sign-up, no fees and no usage cap.
Does OTP Generator store my data?
No. It runs in your browser; nothing is uploaded.