Local 2FA lab
2FA test tool for TOTP and HOTP
Generate codes, build otpauth:// QR codes, diagnose clock drift and export
deterministic test vectors. Everything is computed in this browser tab — no secret is
uploaded, stored on a server, or sent anywhere.
- No account
- No uploads
- No tracking
- Works offline
Test secrets only. Do not paste a production 2FA secret. Saved configurations remain in this browser and are not encrypted.
Last updated 2 December 2026
Configuration
Letters A–Z and digits 2–7. Spaces and padding are ignored.
Saved test configurations
Stored as plain text in this browser's local storage. Use test secrets only.
Live code
SHA-1 · 6 · 30sotpauth URI & QR
Scan this with Google Authenticator, AuthHub or any RFC-compatible app and compare the code with the one above.
The URI and QR follow the code type in the configuration. In HOTP mode the counter value is used.
Import an existing otpauth:// URI
Query strings stay in this page; nothing is sent to a server.
Google Authenticator export
Scan the QR code from “Transfer accounts → Export accounts” in Google Authenticator and paste the link below. The payload is decoded here; accounts and their current codes are listed.
The link contains every account's secret. Use a test export only.
| # | Issuer | Account | Type | Secret | Code | Action |
|---|
Clock drift test
Compare the code at ±90 seconds to reproduce failures near a refresh boundary.
| Offset | Code | Counter |
|---|---|---|
| Run the test to compare codes around the current step. | ||
Code verification
Check a code against a configurable window, the way a server would.
Regression vectors
Deterministic time → TOTP fixtures for unit tests and cross-language checks.
How to debug a TOTP mismatch
A failing one-time password is almost never random: it is one of the parameters that disagree between the authenticator and the verifier. This 2FA test tool exists to isolate them one at a time, without touching a production account.
- Confirm the shared secret. Decode the Base32 value both sides use and compare the raw bytes, not the string. Spaces, padding and case are usually harmless, but a single wrong character changes every subsequent code.
- Match the type and parameters. Confirm TOTP versus HOTP first, then make the algorithm (SHA-1, SHA-256, SHA-512), digits (6 or 8) and — for TOTP — the period (30 or 60 seconds) identical on both sides.
- Scan the generated QR code. Import the provisioning URI that follows the configured type. If the app shows the same code you see here, the app path is consistent and the problem is on the verifier side.
- Compare the HOTP counter. HOTP codes drift when the counter desynchronises; the server counter and the counter here must match. In TOTP mode, skip to the drift test instead.
- Run the drift test. TOTP codes fail disproportionately near a 30-second boundary. Comparing values at ±90 seconds shows whether a clock offset or a too-narrow verification window is responsible.
- Freeze the behaviour with vectors. Export a handful of timestamp → code pairs before changing an implementation, then assert them in CI so a refactor cannot silently alter truncation or rounding.
TOTP vs HOTP at a glance
| TOTP · RFC 6238 | HOTP · RFC 4226 | |
|---|---|---|
| Moving factor | Unix time divided into fixed steps | Monotonically increasing counter |
| Common baseline | 30 seconds · 6 digits · HMAC-SHA-1 | 6 digits · HMAC-SHA-1 |
| Typical mismatch | Clock drift, period, digits, algorithm or secret | Counter desynchronisation, digits or secret |
| Provisioning URI | otpauth://totp/… | otpauth://hotp/…&counter=N |
What this page computes
- TOTP generator for SHA-1, SHA-256 and SHA-512 with 6 or 8 digits and 30- or 60-second steps.
- HOTP reference sharing the same Base32 key and digit configuration.
- otpauth:// provisioning with a standards-compatible QR code you can scan with any authenticator.
- Verification window testing to see exactly how many steps a server should tolerate.
- Deterministic fixtures as copyable or downloadable JSON for unit tests and CI.
- Google Authenticator export decoding: lists accounts, their codes and duplicate entries from an otpauth-migration payload.
Standards behind the results
TOTP is defined by RFC 6238
and builds on the HOTP construction in
RFC 4226.
The otpauth:// scheme is documented in the Key URI Format used by Google
Authenticator. Use the RFC test vectors as the final protocol reference and this page as an
interactive implementation check.
Frequently asked questions
Is it safe to paste a real 2FA secret into this page?
No. Use temporary test secrets only. Nothing is uploaded — every calculation runs in your browser and the page makes no network requests — but browser extensions, screen sharing and clipboard history can still expose a secret.
Why does my authenticator show a different code than my server?
The most common causes are a mismatched Base32 secret, a different period (30 vs 60 seconds), a different digit count, a different HMAC algorithm, or clock drift between the phone and the server. Fix one variable at a time and re-test near a refresh boundary.
Can I scan the generated QR code with Google Authenticator?
Yes. The QR code encodes a standard otpauth:// URI, so Google Authenticator, AuthHub, 1Password and other RFC-compatible apps can import it. Treat any account created this way as a test account.
What is the difference between TOTP and HOTP?
Both derive a short code from a shared secret with HMAC. TOTP uses the current Unix time divided into fixed steps as the moving factor (RFC 6238), while HOTP uses a monotonically increasing counter that both sides must keep in sync (RFC 4226).
Are the exported test vectors deterministic?
Yes. Each vector is the TOTP value for an explicit Unix timestamp and counter, so the same secret, algorithm, digits and period always produce the same output in any language or test suite.
Does this tool work offline?
Yes. After the page loads, no network access is required or permitted by its Content Security Policy. You can also save the page and run it locally over HTTPS.