TOTP Generator Online
Runs in your browser. Nothing is sent to us. Is it safe?
A TOTP generator turns a secret key and the current time into the six-digit code that websites ask for when you sign in with two-factor authentication. This one runs in your browser, so your secret is processed on your own device and is not sent to our server.
What this TOTP generator does
TOTP stands for time-based one-time password. It is defined in RFC 6238 and is the method behind most authenticator apps. Paste a Base32 secret (or an otpauth:// link), choose the settings the service uses, and the tool shows the current code with a countdown to the next one. The code appears instantly, with no account and no passphrase. If you want it one tap away next time, you can save the account in the optional encrypted vault.
You can set:
- Digits: 6 or 8.
- Period: 30 or 60 seconds.
- Algorithm: SHA-1 (the common default), SHA-256 or SHA-512.
If you have a QR code instead of a secret, use the QR code reader. If a service gave you an otpauth:// link, use the otpauth URI decoder.
How to generate a TOTP code
- Get the secret. During 2FA setup, choose the option such as "can't scan the code?" and copy the string of letters and numbers.
- Paste it into the generator. Spaces and lowercase letters are fine. The secret should use only the letters A to Z and the digits 2 to 7. The code appears immediately.
- Match the settings. Leave the defaults (SHA-1, 6 digits, 30 seconds) unless the service says otherwise.
- Copy the code. Press the Copy button. It refreshes when the countdown ends.
- Confirm on the website. Paste the code into the service to finish setup. Press Clear to wipe the key from the page, or "Save to my accounts" if you want to keep it in the optional encrypted vault.
How the code is calculated
Knowing the idea helps when something goes wrong. Your secret and the current time are combined: the time is divided into steps (30 seconds by default), and the step number is run through a keyed hash (HMAC) using your secret. The result is cut down to a short number of digits. The website holds the same secret and does the same sum, so both sides arrive at the same code without ever sending it.
Two consequences matter in practice. First, the clock must be right. If your device's time is off by more than a step or so, the codes will not match. Second, the secret is everything. Anyone who has it can produce your codes, which is why you should keep it private.
When people use a TOTP generator
- Recovering access. You kept the setup key from when you enabled 2FA, but lost the phone that held the codes.
- Using a computer. You want codes on a laptop or desktop where installing an app is not possible or allowed.
- Testing an integration. Developers check that their TOTP implementation produces the same codes as the standard, using a test secret.
- Sharing a team login responsibly. Some teams keep a shared service account's TOTP in one controlled place. Do this only if the service's rules allow it.
- Learning. Seeing how digits, period and algorithm change the code makes the standard easy to understand.
If the code is rejected
- Check your clock. Turn on automatic date and time. This fixes most problems.
- Check the secret. Re-copy it. Look for confusion between the letter O and the digit 0; real Base32 secrets contain 2 to 7, not 0, 1, 8 or 9.
- Check the settings. Some services use 8 digits, a 60-second period or SHA-256. The QR code carries these; a typed secret does not, so a mismatch is possible.
- Use a fresh code. Wait for the countdown to roll over and try the next code.
A note for developers
If you are testing your own implementation, compare its output with the test values published in RFC 6238, appendix B, which list the expected codes for fixed secrets and timestamps. A mismatch almost always comes down to the wrong algorithm, the wrong digit count, or a clock offset in the test setup, not to the hash itself.
Private by design
The calculation runs in your browser. In instant mode the secret stays in page memory only and is wiped when you press Clear or leave the page. If you save an account, it is encrypted with your passphrase (PBKDF2-SHA256 and AES-GCM-256) and stored only on your device. This page contains no ads and no analytics. We explain how to verify this yourself, and where the limits are, in Is it safe?.
Related tools
- 2FA code generator: the beginner-friendly route from a secret key to a working login.
- HOTP generator: for counter-based codes.
- How to enable 2FA: step-by-step guides for popular services.
Frequently asked questions
What is a TOTP generator?
A TOTP generator calculates a time-based one-time password from a shared secret and the current time. The same secret and the same clock produce the same code on your device and on the website, which is how the site knows the code is yours.
Why does my TOTP code not work?
The usual cause is a wrong clock. TOTP depends on the time, so a device that is more than about 30 seconds off will produce codes the server rejects. Turn on automatic time on your device. The other causes are a mistyped secret, or a service that uses a non-default digit count, period or algorithm.
What are the default TOTP settings?
Most services use SHA-1, 6 digits and a 30-second period. Some use 8 digits, SHA-256 or SHA-512, or a 60-second period. When a service shows a QR code, those settings are inside it.
Is it safe to paste my real secret here?
The page calculates codes in your browser and does not send your secret to our server. You can confirm that in your browser's network panel; the steps are on our safety page. If you want to be careful, try a throwaway secret first.
Is TOTP the same as Google Authenticator?
Google Authenticator is one app that generates TOTP codes. TOTP is the open standard (RFC 6238) that many apps implement, so a secret from one service works in any TOTP app, including this tool.
How long is a TOTP code valid?
Usually 30 seconds. Many servers also accept the previous or next code to allow for small clock differences, but you should enter a fresh code rather than rely on that.
Can I use this to test my own login system?
Yes. Developers often use a TOTP generator with a test secret to check that their implementation matches the standard. Use a test secret, never a production one.
Does the generator work offline?
After the page has loaded, the calculation happens locally and needs no connection. Whether the page itself is available offline depends on your browser.
Save accounts in an encrypted vault (optional)
Want your codes kept on this device? Create a vault protected by your passphrase. Skip it if you only need a code right now.