2FA codes, secrets and QR setup
- Free
- No sign-up
- No upload
- Works offline
Tool facts
- Saves as
PNG- Price
- Free, no sign-up, no watermark
- Are files uploaded?
- No. Everything is processed in this browser, on your device.
- Offline use
- Works without a connection once this page has loaded
- Built with
- Web Crypto, Canvas, and node-qrcode
- Browser
- A recent Chrome, Edge, Firefox or Safari, on computer or phone.
Check it yourself: press F12, open the Network tab, then use the tool. No request carries your data.
About TOTP Generator
TOTP Generator shows the current time-based one-time password for a Base32 secret key, the same 6-digit code an authenticator app such as Google Authenticator, Microsoft Authenticator or Authy would display. It follows RFC 6238: the secret and the current 30-second time step are fed into HMAC, and the result is cut down to 6 or 8 digits. A countdown ring shows how long the code stays valid, and the next code is shown too.
Developers can use it to test a two-factor login: generate a random secret, scan the QR code with a phone and check that both show the same code, or paste an existing otpauth:// URI to load all of its settings at once. SHA-1, SHA-256 and SHA-512, 6 or 8 digits and 30 or 60 second periods are supported. Codes are calculated with your browser's Web Crypto API, so secrets never leave your device.
TOTP Generator runs entirely in your browser. Your data is processed on your device and is never uploaded to Qiyi or anyone else.
How to use TOTP Generator
- Paste your Base32 secret (or a full otpauth:// URI) into Secret key, or click Random secret to create a new one.
- Leave Algorithm, Digits and Period at SHA-1, 6 and 30 s unless the service specifies other values.
- Read the current code next to the countdown ring; click it or Copy code to copy it.
- To set up an authenticator app, enter an Issuer and Account, then scan the QR code or copy the otpauth URI.
Frequently asked questions
Why doesn't the code match my authenticator app?
TOTP depends on the clock, so first check that your device's time is set automatically; a difference of more than about 30 seconds gives different codes. Then check that the secret is complete and that the algorithm, digits and period match the service. Most services use SHA-1, 6 digits and 30 seconds, and many apps ignore other settings.
Is it safe to paste a real 2FA secret here?
The page calculates codes locally and makes no network requests with your secret. Still, anyone who sees the secret or the QR code can generate your codes forever, so only do this on a trusted device, and never share screenshots of the QR code.
What is the otpauth:// URI?
It is the Key Uri Format used by authenticator apps: otpauth://totp/Issuer:account?secret=BASE32&issuer=Issuer&algorithm=SHA1&digits=6&period=30. The QR code that websites show during 2FA setup contains exactly this text.
How long should a TOTP secret be?
RFC 4226 requires at least 128 bits and recommends 160 bits. The random secret generator creates 160 bits (32 Base32 characters) for SHA-1, 256 bits for SHA-256 and 512 bits for SHA-512, using crypto.getRandomValues.
Does it support HOTP counter-based codes?
No, only time-based TOTP codes. otpauth://hotp URIs are rejected with a message.