OTP Generator

Codes are generated in your browser. The secret is not saved anywhere unless you save it to the vault.

About the OTP Generator

The OTP Generator computes Time-based (TOTP, RFC 6238) and counter-based (HOTP, RFC 4226) one-time passwords entirely in your browser. Paste a Base32 secret or an otpauth:// URI and the page shows a live code right away, with no sign-up and no vault, and it can turn the secret into an otpauth:// QR code for Google Authenticator, Authy, 1Password, or any other authenticator app. If you want to keep a key, save it to the optional encrypted vault: vault encryption uses PBKDF2-derived keys (or WebAuthn PRF on supporting hardware) to wrap each secret with AES-256-GCM in IndexedDB. Use it for developer 2FA testing, ephemeral access without your phone, or any audit and pen-test workflow where you need a code on demand without the round-trip through a phone you may not have on hand.

Updated: May 7, 2026

How to use the OTP generator

  • Paste a Base32 secret or an otpauth:// URI on the Generate tab. The current code appears immediately, with a countdown for TOTP; choose TOTP or HOTP, the algorithm, digits, and period or counter if your service uses non-default settings.
  • Click Show QR code, add an issuer and account name, and scan the QR code with your authenticator app, or copy the key URI.
  • To keep a key, TOTP or HOTP, click Save to vault. On first use you create the encrypted vault with a master password (PBKDF2 with 600,000 iterations, the OWASP 2026 recommendation) or a WebAuthn-bound passkey with the PRF extension; on the Vault tab, Add also accepts camera and image QR scans.
  • Each entry shows the current code (6 or 8 digits). A TOTP entry adds a countdown bar and the seconds left in its time step (30 seconds by default, or the period the key specifies); an HOTP entry shows its counter and a Next code button that saves the next counter before showing the new code. Click the copy icon to copy it to the clipboard; clicking the code selects it.
  • Use the Export button to download a backup of the vault. You choose a backup password (at least 12 characters); the keys are encrypted with AES-256-GCM under a key derived from it with PBKDF2-HMAC-SHA-256 (600,000 iterations, random salt), and only the encrypted JSON file reaches your downloads folder. Import asks for the same password. Older unencrypted backup files still import after a confirm step, with a warning to delete them.
  • Use Lock (or wait for the auto-lock timer to fire) to seal the vault again. Subsequent code generation requires re-authentication.

Common use cases

  • Developer 2FA testing. Spin up a test account on a service that requires TOTP, store the secret here, and you can generate codes from the same machine you are running automated tests on — no phone juggling, no round-trip through Google Authenticator while debugging a Selenium flake.
  • CI/CD secret rotation drills. When rotating service-account credentials that include TOTP-protected paths, the generator gives a deterministic code stream you can paste into the rotation script — useful for both interactive runs and as a fallback when the production OTP source is being recycled.
  • Ephemeral 2FA without a phone. Travel laptop without phone, phone in repair, or phone storage compromised mid-incident: as long as you have a backup of the secret (or the original QR), this tool generates the same codes any other RFC 6238 client would.
  • Audit and pen-test workflow. Red team and security audits often need to demonstrate that a given account is reachable without invoking the operator's personal phone. A browser-local, vault-encrypted TOTP generator keeps the test artifact reproducible and out of personal devices.
  • Verifying a service's TOTP implementation. Generate codes here against a known-good secret and compare to what your application accepts. Mismatches usually trace to clock drift, the wrong digit count, or a non-default period or algorithm.

Privacy and security

On the Generate tab, the secret you paste stays in page memory only: it is not written to the URL, localStorage, IndexedDB, or analytics, and it is gone when you leave the page. Saved secrets are stored exclusively in your browser's IndexedDB, encrypted at rest with AES-256-GCM. The data-encryption key is wrapped with AES-KW using a key-encryption key derived from your master password (PBKDF2-HMAC-SHA-256, 600,000 iterations) or your WebAuthn PRF output (HKDF-SHA-256). Plaintext secrets never touch disk, never appear in URL parameters, and are never sent to any server — verifiable by watching the network tab while you generate codes. The page implements idle-based auto-lock and visibility-change auto-lock to limit the time the unwrapped key sits in memory.

Tips and pitfalls

  • Clock drift is the #1 cause of "wrong" codes. TOTP is time-based: the algorithm divides the current Unix time by the period (default 30s) and computes HMAC over the resulting counter. If your machine clock is off by more than a half-period, codes will not match. macOS and Windows both expose an NTP-synced clock by default, but virtual machines, dual-boot setups, and devices that have been offline for a while can drift. Verify with date -u and a known-good NTP server.
  • Base32 padding bugs trip people up. RFC 4648 Base32 secrets may or may not be padded with = characters, and authenticator apps differ in tolerance. The generator strips padding, normalizes case, and validates the alphabet (A-Z and 2-7), so you can paste secrets in any common variant.
  • Always export a vault backup before changing your master password or migrating browsers. Browser storage is not synced across devices by default, and a forgotten master password is unrecoverable — by design.
  • TOTP and HOTP are different. HOTP (RFC 4226) is counter-based and used by some hardware tokens; TOTP (RFC 6238) derives the counter from the time. Most consumer 2FA is TOTP. Switch the Type to HOTP and set the counter if your service uses HOTP; an HOTP key saved to the vault keeps its counter, which advances each time you click Next code.
  • Phone-loss recovery: keep the original secret or QR code somewhere offline. Once enrolled, most services do not re-display the secret, so your only recovery paths are (a) the service's account-recovery flow, (b) a stored backup of the secret, or (c) one-time backup codes if the service issues them. Treat the export file from this tool as one such backup.
  • Never paste your TOTP secret into a chat, ticketing system, or email — the secret grants permanent code-generation ability until the service rotates it. The same caution applies to QR-code screenshots, which encode the raw secret in their image.

Frequently Asked Questions

Is this compatible with Google Authenticator and Authy?
Yes — they all implement RFC 6238 with the same defaults (SHA-1, 6 digits, 30-second period). A secret enrolled in any one of them will produce identical codes in this generator and vice versa. Non-default parameters (SHA-256, SHA-512, 8 digits, 60-second period) are also supported, but check that your service issues a matching otpauth:// URI for them.
What is TOTP and how does it differ from HOTP?
TOTP (RFC 6238) is a time-based one-time password: the counter is derived from the current Unix time divided by a configurable period (default 30s). HOTP (RFC 4226) is the counter-based predecessor: each code increments a counter explicitly, used by some hardware tokens like YubiKey OATH-HOTP. TOTP is by far the more common consumer 2FA standard. This generator supports both: choose HOTP and use Next code to advance the counter.
Why does my code not match the service?
Three usual suspects, in order of frequency: (1) clock drift — your device time is off; verify with an NTP query, (2) algorithm or digit mismatch — the service uses SHA-256 or 8 digits while your entry is the SHA-1/6-digit default, (3) Base32 secret was copied with extra whitespace or a 0/O character substitution. The generator surfaces the parameters of each entry so you can compare them to whatever the service's setup screen documents.
How is the encrypted vault implemented?
AES-256-GCM for the secret blob, AES-KW for key wrapping, PBKDF2-HMAC-SHA-256 with 600,000 iterations (OWASP 2026 minimum) for password-derived keys, or HKDF-SHA-256 for WebAuthn PRF outputs. The wrapped key and ciphertext live in IndexedDB; auto-lock fires after 5 minutes of tab hidden or 10 minutes of idle. None of the cryptographic material ever leaves your browser.
What happens if I lose my master password?
The vault is unrecoverable — that is the point of password-derived encryption. Reset clears IndexedDB and requires you to re-enroll every secret from your originals or backups. Always export a backup before changing passwords or migrating browsers.
Can I export my secrets to another authenticator app?
Yes, one key at a time: each vault entry can show its otpauth:// QR code, which Google Authenticator, Aegis, Raivo, and 1Password all scan. The Export file is password-encrypted JSON with a documented layout (PBKDF2-HMAC-SHA-256 settings, salt, AES-256-GCM IV, and ciphertext, all Base64), so you can also decrypt it elsewhere with the password, for example with a short WebCrypto or Python script, and re-enroll the keys.
Are hardware tokens supported?
Indirectly. If your hardware token is OATH-TOTP-compatible (e.g., YubiKey 5 with the OATH applet) you can program the same Base32 secret into both the hardware token and this tool, and they will emit identical codes. Pure FIDO2/WebAuthn keys do not use TOTP — they are an entirely different challenge-response protocol.
Why a 30-second window?
30 seconds is the default period in RFC 6238. Smaller windows force more frequent server-side counter alignment but improve resistance to passive code interception; larger windows are more forgiving of clock drift. Some services pick 60 seconds; the generator honors whatever period is encoded in the otpauth:// URI you import.
Can I script this for automated tests?
Not directly — the page is interactive. For programmatic TOTP in a test suite, use the otpauth or pyotp libraries with the same secret you stored here. The standard guarantees that every conforming implementation produces the same codes for the same secret and time.
What is the otpauth:// URI format?
otpauth://totp/Issuer:account?secret=BASE32&issuer=Issuer&algorithm=SHA1&digits=6&period=30. The format is documented in the Google Authenticator key URI specification, which has become a de facto standard. QR codes from 2FA-setup pages encode this URI directly; you can paste it into the generator instead of typing the secret, and the generator can build this URI and its QR code from a secret. HOTP URIs use otpauth://hotp/… with a counter parameter instead of period.
Can I generate a QR code for an authenticator app?
Yes. Enter a secret, click Show QR code, and fill in the issuer and account. The QR code encodes a standard otpauth:// key URI that Google Authenticator, Authy, Aegis, and 1Password can scan. Anyone who scans it can generate your codes, so do not share screenshots of it.
How do I back up my secrets safely?
Use the Export button and choose a backup password: the file holds your keys encrypted with AES-256-GCM under a PBKDF2-HMAC-SHA-256 key (600,000 iterations), so it is only as strong as that password. Use a long, unique one and keep it apart from the file. Offline storage, such as an encrypted USB stick, is still the safest place; a cloud drive is reasonable only with a strong password. Without the password the backup cannot be restored.
Does the page work offline?
Yes. After initial load, code generation, vault unlock, and copy-to-clipboard all work without network access as long as you keep the tab open. No request carries your secrets or codes, which you can verify in the browser DevTools network panel; the other requests load the site's code, analytics, and ads.