No upload, no storage — it happens in this tab
Two-factor codes,
computed here and nowhere else
Paste a Base32 secret and this page's JavaScript computes the TOTP or HOTP codes itself. It also builds the otpauth:// URI and the QR code locally, shows which of the five ±2 windows a received code falls into, and tells you how far your device clock has drifted. Zero server calls.
- RFC 6238 · 4226
- Web Crypto HMAC
- SHA-1 · 256 · 512
- ±2 step check
- Local SVG QR
- 0 sent · 0 stored
TOTP and HOTP workbench
The secret never leaves this browser · 0 sent · 0 stored · 0 external requests
Secret
Base32Each button makes a new secret from a cryptographic random source (crypto.getRandomValues) and replaces the current one.
Fill from an otpauth:// URI
The QR contains the secret in plain form. Mind screen sharing and captures.
TOTP code
TOTPCode for the current step
±2 step verification
±2Enter a received code and five steps from −2 to +2 around the current step are compared. Useful when you suspect a clock difference.
| Offset | Code | Valid range | Result |
|---|
The table shows the codes for five steps around the current (or fixed) time. They are secret material: hide them while screen sharing.
HOTP counter
HOTPStep the counter up and down with the same secret to see how the code changes. Verification compares a ±2 range around the counter.
Official RFC test vectors
The 18 TOTP vectors of RFC 6238 and the 10 HOTP vectors of RFC 4226, recomputed by this page and compared with the published values.
| Vector | Time / counter | Published | Computed | Result |
|---|
The TOTP vectors use 8-digit codes and the 20, 32 and 64-byte seeds defined by the RFC. They run independently of the secret you entered.
What is guaranteed, and what is not
- Nothing is sentNo fetch, XHR, WebSocket or sendBeacon is used. Every script on the page ships in the package.
- Nothing is storedNo localStorage, sessionStorage, cookie or IndexedDB write. Reloading leaves no trace.
- The QR is local tooThe symbol is drawn by the encoder inside the page, not by an outside service.
- No login on your behalfThis tool shows and checks codes; it never signs in to any service or submits a code.
How it works
- 01
Bring the secret
Generate a fresh 16, 20 or 32-byte secret, or paste the Base32 string or otpauth:// URI from your authenticator. Spaces, lowercase and padding are cleaned up for you.
- 02
Read the code
Choose the algorithm, digit count and period to see the current step's code and the seconds left. Fix the timestamp to reproduce any moment exactly.
- 03
Verify and compare
Enter a received code and five steps from −2 to +2 are compared: which one matched, and how many seconds the clocks disagree. The 28 official RFC vectors are checked the same way.
What is on one screen
Secret generation and normalisation
crypto.getRandomValues produces 16, 20 or 32 random bytes, shown as Base32. Spaces, lowercase and '=' padding are normalised, and characters outside the alphabet or an impossible length are reported before anything is computed.
Read and write otpauth:// URIs
otpauth://totp/... and otpauth://hotp/... URIs are parsed into issuer, account, secret, algorithm, digits, period or counter — and the current settings can be turned back into a URI.
Local SVG QR codes
No QR service and no CDN: the page's own JavaScript draws the symbol to ISO/IEC 18004. High-contrast SVG with a four-module quiet zone, downloadable as SVG or PNG.
Web Crypto HMAC
SHA-1, SHA-256 and SHA-512 HMAC through Web Crypto, truncated with the RFC 4226 rule into 6 or 8 digits. The secret is used as a key and never leaves the page.
Live ±2 step verification
A received code is compared with −2, −1, 0, +1 and +2 around the current step, showing the matching offset and the drift in seconds. HOTP does the same while you step the counter up and down.
Official RFC test vectors
The 18 TOTP vectors of RFC 6238 (SHA-1, SHA-256, SHA-512) and the 10 HOTP vectors of RFC 4226 are recomputed in one go and compared with the published values, so you can see the implementation is right.
Why the secret never reaches a server
A TOTP secret is a password. If it leaks once, every 30-second code leaks with it — so this tool is built with no path that could send it anywhere.
No upload
The secret and the codes are handled only in this page's JavaScript memory. Open the developer tools network tab and you can watch the external request count stay at zero.
No storage
Nothing is written to a server, cookie, localStorage, sessionStorage or IndexedDB. Reload the page and the input is gone; nothing is left in the browser.
No API
There is no server function or JSON endpoint for code generation, QR drawing or URI parsing. The whole site is static HTML and JavaScript.
Five guides
From the arithmetic to the official vectors, clock drift, secret hygiene and offline checks — in order.
How a TOTP code is actually built
Time → counter → HMAC → truncation. Following the four steps that produce a code.
Read →02Validating an implementation with the RFC 6238 and 4226 test vectors
Checking that your arithmetic matches the 28 values the standards publish.
Read →03Clock drift and the ±2 step window: where to look when a code fails
Step boundaries, the difference between ±1 and ±2, and measuring the error in seconds.
Read →04Handling a Base32 secret and its QR code safely
Alphabet, padding, URI structure, and the risks of QR codes and screen captures.
Read →05Checking a 2FA code offline, step by step
Secret, clock and a ±2 check: confirming a code on an air-gapped machine.
Read →Frequently asked
Is the secret really not leaving my browser?
Correct. Input, computation, QR drawing and downloads all run in this page's JavaScript. No request carries the secret, and you can confirm that in the developer tools network tab.
Which authenticators does it work with?
Any app that follows RFC 6238 TOTP or RFC 4226 HOTP. SHA-1, SHA-256, SHA-512, 6 or 8 digits, and 30-second, 60-second or custom periods are supported.
Does a clock difference change the code?
Yes. TOTP feeds the 30-second time step into HMAC, so a skewed device clock produces a different code. This tool compares a ±2 window and reports the drift in seconds.
May I log in with a code generated here?
The arithmetic is correct, but the actual login is safer in your original authenticator or on the service's own screen. This is a lab for checking and diagnosing.
Where is the QR code generated?
The JavaScript shipped with the page draws it to ISO/IEC 18004. No secret is sent to a QR service.
Does it work offline?
Once the page is open, computing and verifying work with the network off. Web Crypto itself requires https or localhost.
Put a secret in and read the code
An example secret is already loaded. Replace it with yours and the code changes on the spot.
Open the workbench