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.

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

01

Configuration

Letters A–Z and digits 2–7. Spaces and padding are ignored.

02

Live code

SHA-1 · 6 · 30s
------
Remaining
30s
Counter
—
Time step
—
03

otpauth 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.

04

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.

05

Clock drift test

Compare the code at ±90 seconds to reproduce failures near a refresh boundary.

TOTP codes for offsets between −90 and +90 seconds
OffsetCodeCounter
Run the test to compare codes around the current step.
06

Code verification

Check a code against a configurable window, the way a server would.

07

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.

  1. 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.
  2. 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.
  3. 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.
  4. 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.
  5. 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.
  6. 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

Comparison of TOTP and HOTP
TOTP · RFC 6238HOTP · RFC 4226
Moving factorUnix time divided into fixed stepsMonotonically increasing counter
Common baseline30 seconds · 6 digits · HMAC-SHA-16 digits · HMAC-SHA-1
Typical mismatchClock drift, period, digits, algorithm or secretCounter desynchronisation, digits or secret
Provisioning URIotpauth://totp/…otpauth://hotp/…&counter=N

What this page computes

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.