Language: English

tools / 2fa

2fa/

Google Authenticator-style TOTP codes. Click any card to copy its code.

Keys

00 keys

What is TOTP

TOTP is the one-time password defined in RFC 6238: an HMAC of the number of the current 30-second time step, keyed with a shared secret, is cut down to 6 digits, so a phone and a website get the same code without talking to each other. This page keeps keys in your browser and shows the current code for each account.

How it works: HMAC of the time-step number, then cut down to digits

  1. The key is written in Base32 and is first decoded into bytes.
  2. The current Unix time in seconds is divided by the period (30 seconds by default) and rounded down, giving the time-step number, which is written as 8 bytes.
  3. These 8 bytes are run through HMAC with the key; the default algorithm is SHA-1, which gives 20 bytes.
  4. The low 4 bits of the last byte give an offset; 4 bytes are taken from there and the top bit is dropped, giving an integer, which is taken modulo 10 to the power of the number of digits (6 by default) and padded with leading 0s to that many digits. This step is called dynamic truncation and comes from HOTP in RFC 4226.

Example

A test vector from RFC 6238 Appendix B: the key is the ASCII string 12345678901234567890 written in Base32, time 59 seconds, 8 digits, SHA-1, time-step number 1:

Input
GEZDGNBVGY3TQOJQGEZDGNBVGY3TQOJQ
Output
94287082

Sources

FAQ

Where are my keys stored? Do I lose them if I switch browsers or clear the cache?

Yes, they are lost. Keys are stored only in the localStorage of the current browser, so you will not see them after switching browsers or computers or clearing site data, and a private window wipes them when it closes. After adding a key, click "Export backup" right away to download 2fa-backup-date.json; in the new environment click "Import" and choose that file to restore.

Are my keys safe? Are they uploaded to a server?

They are not uploaded, but they are not encrypted either. The page makes no request that sends a key anywhere, and codes are computed in your browser. However, keys sit in localStorage as plain text, and the exported backup file is plain text too, so anyone who can use this browser or gets the backup file can read them. Do not use it on a shared computer, and for important accounts such as exchanges and wallets, use an authenticator app on your phone instead.

The label is cut off. How do I see the full secret key?

Click ✎ in the top-right corner of the card to open the edit window. It shows the full label and secret key; click "Copy" to take the key to an authenticator app on your phone. You can change both the label and the key there, and "Save" applies the change. A new key gives new codes, while the digits, period and algorithm stay as they were. On a computer, ✎ and the delete button only appear when you move the mouse over the card.

What should I do when it says the key is invalid?

A key must be Base32: only the letters A-Z and the digits 2-7, at least 8 characters. Spaces, hyphens and equals signs are removed and lowercase is converted to uppercase, so a key written in groups of four can be pasted as it is. A 0, 1, 8, 9 or any other symbol usually means a mistyped character, for example the letter O copied as the digit 0. An otpauth://totp/ link from the website can also be pasted into the same box.

What if the website says the code is wrong?

Check your computer's clock first, then the parameters. The code changes every 30 seconds based on the device's current time, so an inaccurate clock makes it mismatch; turn on automatic time sync. When you type in a key by hand, it uses the defaults of 6 digits, 30 seconds and SHA1; if the website uses different settings, paste the otpauth:// link it gives you, or import a JSON file that carries those parameters.

Can I add a key by scanning a QR code? Can I import the QR code exported by Google Authenticator?

Neither works. This page cannot read QR codes and needs the key as text: many websites offer an option like "Can't scan the QR code?" during setup, and it shows the Base32 key. The QR code made by Google Authenticator's "Export accounts" uses a different format that starts with otpauth-migration://, which this page does not recognize; you would have to recover the keys with another tool first, or set up each website again.

Which formats can I import, and what happens to duplicate keys?

It accepts the backup JSON exported by this site, otpauth:// links one per line, and text with one "label key" per line; a .json or .txt file (up to 1 MB) can be dragged straight into the import window. Entries with the same key are skipped automatically, and when the import finishes it tells you how many were added, plus how many were duplicates or could not be parsed.

Does it support 8-digit codes, a 60-second period or SHA256?

Yes, but the parameters have to come in through an otpauth:// link or a backup JSON. Codes can have 6 to 8 digits, the period can be 1 to 300 seconds, and the algorithm can be SHA1, SHA256 or SHA512. Only time-based TOTP is supported, not counter-based HOTP; pasting an otpauth://hotp/ link shows a message that only TOTP is supported.

Add key

Edit key

Import

Supports backup files or JSON exported from this site, lzltool data, otpauth:// links (one per line), and lines of "label secret". Duplicate secrets are skipped.