OTP Generator
Free online OTP generator. Create one-time passwords locally in your browser - no upload, no account, no tracking.
- Secret never leaves your browser
- Nothing you paste is uploaded
- Works instantly, no signup
Last updated: Oct 26, 2026 10:37:49
Generate a one-time code
Computed in your browser: the secret is not uploaded and not stored. The page makes one analytics request and nothing else.
An OTP generator turns a shared secret into a short code that works once and then expires. That is the whole idea: even if someone watches you type the code, it is useless a minute later. This page generates one-time passwords in your browser — there is no request to a server, no account, and nothing stored.
Most people arrive here holding a Base32 string from an authenticator setup screen and needing one thing: the six digits, right now. If that is you, paste the key into the field above and read the result. The rest of this page explains what the code is, which parameters change it, and what to do when it does not work.
What an OTP actually is
A one-time password is a value computed from two inputs: a secret that both you and the service know, and something that changes over time or per use. The service never has to store your code, and the code never has to travel over the network to reach you. It is derived, not delivered.
That property is why OTPs are the backbone of two-factor authentication. A password can be replayed by anyone who sees it; an OTP is bound to a narrow window, so replaying it fails. The trade-off is that the code is only as good as the clock and the secret — which is exactly where most failures come from.
OTP vs TOTP vs HOTP: three names, two mechanisms
People use “OTP” loosely. Underneath, there are two constructions, and the difference matters when a code does not work.
| Construction | What changes each time | Validity | Needs a counter sync | Typical use |
|---|---|---|---|---|
| TOTP (RFC 6238) | The clock: every 30 seconds, a new time step | One time step, plus the server’s tolerance window | No — both sides just need the time | Authenticator apps, Google/Microsoft/Apple accounts, banks |
| HOTP (RFC 4226) | An integer counter that increments on every use | Until the counter advances | Yes — a lost count desynchronizes the device | Hardware tokens, some legacy VPNs, printed scratch codes |
| “OTP” as a generic term | Either of the above, or an SMS/email code | Minutes | Depends | SMS verification, bank transfers |
When someone says “authenticator code”, they almost always mean TOTP. When a code changes only after you press a button, it is HOTP. This tool handles both: paste a otpauth://totp/… or otpauth://hotp/… link and it switches automatically.
How to use this generator
- Get the secret. It is the Base32 string your service shows during setup, usually behind “Can’t scan the code?” or “Enter manually”. It looks like
JBSWY3DPEHPK3PXP. - Paste it into the field above. Either the raw key or the full
otpauth://link works. Spaces, dashes and lowercase letters are tolerated. - Check the parameters. If your service uses SHA-256, 8 digits or a 60-second period, set them — otherwise the digits will look valid but be rejected.
- Read the code. It refreshes when the 30-second window rolls over. The bar under the code shows how much time is left; it turns orange in the last five seconds.
- Paste it into the login form promptly. A code entered at second 29 is already dead on arrival.
No step requires a network connection. Turn off Wi-Fi and the generator keeps working — that is the design, not a bonus feature.
Where the secret comes from
Three routes, in order of how often they work:
- Manual entry. During setup, most services offer “Can’t scan the QR code?”. That opens a text field with the Base32 secret. Copy it verbatim.
- Decoding the QR code. A QR code is just a rendered
otpauth://URI. Any QR reader that shows the raw text will expose the secret inside it. - Exporting from another app. Some authenticator apps export all accounts as
otpauth-migration://links. This generator does not accept the migration bundle format, so extract the individual secrets instead.
The secret is the crown jewel. Whoever has it can generate valid codes forever, without your phone. Treat it like a password, not like a code.
The four parameters that change the code
| Parameter | Default | What happens if you get it wrong |
|---|---|---|
| Secret | — | Codes are simply wrong. A single mistyped character is enough. |
| Algorithm | SHA-1 | Codes are wrong. Most services use SHA-1; enterprise setups sometimes use SHA-256 or SHA-512. |
| Digits | 6 | Six digits look plausible but fail. Some banking and enterprise systems issue 7 or 8. |
| Period | 30 s | The code is valid but out of phase — you may hit the right value only by luck. |
If you are unsure, try the defaults first. A wrong algorithm or digit count produces a code that looks perfectly normal, which is why this is the most common silent failure.
Why this page computes locally
A web page that asks for your 2FA secret is asking for something valuable, and that deserves scepticism. This one is built so you can check the claim yourself:
- The page is served with a
connect-src 'none'Content Security Policy — the browser refuses to make any network request from it, includingfetch, XHR and WebSocket. - All maths happens with the Web Crypto API, on your device.
- Nothing is written to cookies or local storage. Close the tab and the secret is gone.
- Open the Network panel in DevTools while generating codes: there are no requests.
That is the difference between “we promise not to log it” and “the browser makes logging impossible”.
SMS codes are a different animal
A six-digit SMS code looks identical to an authenticator code, which causes a lot of confusion. They are not the same mechanism:
- An SMS code is generated by the server and sent to you. You cannot compute it, and no app can show it in advance.
- An authenticator code is derived on your device from a secret issued once. Nothing is sent, so nothing can be intercepted in transit.
- The threat models differ. SMS is vulnerable to SIM swapping and to anyone who controls the carrier’s porting process; TOTP is vulnerable to a stolen secret and to clock drift.
If the login screen says “we texted you a code”, this page cannot help. If it says “enter the code from your authenticator app”, it can.
What this page is not
Setting expectations saves support tickets:
- It is not a vault. It does not store accounts, so there is nothing to come back to tomorrow. Save the secret in a password manager if you need it again.
- It does not read SMS. No permission, no inbox access, no background service.
- It does not migrate a whole app. The
otpauth-migration://bundle format is not supported — extract the individual secrets instead. - It does not sync. There is no account and no server, which is exactly why there is nothing to sync.
What it does is narrow and reliable: one secret in, one correct code out, computed on your device.
When the code does not work
Four causes cover almost every case: clock drift, a mistyped secret, a code that expired while you were typing, and a service that expects different parameters. The first is by far the most common — a device that is 40 seconds off will produce codes that are always one step behind.
If the code is rejected, work through 2FA code not working before you reset anything. Resetting an account is the one step that can lock you out permanently.
To check parameters or decode a setup link, the TOTP generator shows how the time step and HMAC are applied; if you are wondering whether your app will agree with the result, the authenticator compatibility notes cover that. If you are new to the acronyms, start with what TOTP is — five minutes there saves a lot of guessing later.
Frequently asked questions
What is the difference between OTP, TOTP and HOTP?
OTP is the general term. TOTP derives the code from the current time and changes every 30 seconds; HOTP derives it from a counter that increments on each use. Consumer authenticator apps almost always use TOTP.
Is it safe to paste my secret key here?
The page cannot send it anywhere: a Content-Security-Policy limits outbound connections to this site plus one analytics host, and nothing is written to storage. Open the Network panel - the only request is the page-view counter, and your key is never part of it.
Why does a valid-looking code get rejected?
Usually the device clock is more than 30 seconds off, or the service expects a different digit count or period. A correct secret with the wrong parameters produces a plausible but always-invalid code.
Can I use this offline?
Yes. Turn off Wi-Fi after the page loads and the generator keeps working, because all maths happens locally.
Does it store my key?
No. There is no cookie, no local storage and no session record. Closing the tab discards the key.
What if my service uses 8 digits or SHA-256?
Select the matching values in the algorithm and digits fields, or paste the full otpauth:// link and they are set automatically.