2FA Code Generator (TOTP)

Paste a secret or an otpauth:// link and the current code appears with a countdown. The secret stays on this page: it is not sent anywhere and not saved.

How it works

Authenticator apps such as Google Authenticator make time-based one-time passwords, TOTP for short, defined in RFC 6238. You and the website share a secret when you scan the setup QR code. From then on, both sides combine that secret with the current time and get the same short code.

The time is cut into steps, usually 30 seconds, and the step number is signed with HMAC using the secret. Four bytes of the result are picked out and turned into a 6 or 8 digit number. Because the step changes every 30 seconds, so does the code.

This page does that calculation in your browser with its built-in Web Crypto. The secret you paste is kept only in the page while it is open; it is never uploaded, logged or stored.

How to use it

  1. 1 Paste the secret (the letters and digits shown under a setup QR code) or a whole otpauth:// link into Secret or otpauth:// link.
  2. 2 If you pasted a link, Digits, Every and Algorithm are filled in from it. For a bare secret, the defaults of 6 digits every 30 s with SHA-1 match almost every site.
  3. 3 Read the current code and the countdown. The next code is shown too, for when the countdown is nearly out.
  4. 4 Press Copy code and paste it into the login form.

Good to know

  • If the codes are always rejected, check your device clock. A clock more than about 30 seconds off gives the code for the wrong step.
  • Secrets use only the letters A to Z and digits 2 to 7. Spaces, dashes and lower case are fine; a 0, 1 or 8 is a typo for O, I or B.
  • This is not a backup for your authenticator unless you keep the secret somewhere safe yourself. The page forgets it when you close the tab.
  • Only paste secrets for your own accounts. Anyone with the secret can make your codes, which is the whole point of keeping it secret.
  • Counter-based (HOTP) links are refused with a message, because their codes depend on a counter the website keeps, not on the time.

Browser support

  • Chrome 94 and later
  • Firefox 93 and later
  • Safari 16.4 and later
  • Edge 94 and later

These are the oldest versions with everything the tool uses. They are worked out from the tool itself, so they change when it does.

Version numbers checked on 2026-09-04.

How 94287082 comes out of a secret and a clock

RFC 6238, the standard behind authenticator codes, ships with test values, so we can follow one code from start to finish and check every step. The test secret is the twenty ASCII characters 12345678901234567890. Authenticator apps show secrets in Base32, and in Base32 that secret is GEZDGNBVGY3TQOJQGEZDGNBVGY3TQOJQ. Paste that into the box above, set Digits to 8 and Algorithm to SHA-1, and you can compare your screen with the numbers here at any time by thinking back to one moment: 59 seconds after midnight on 1 January 1970, UTC.

Step one is the counter. TOTP divides the Unix time by the step length, 30 seconds, and throws away the remainder. At 59 seconds that is floor(59 / 30) = 1. Every second from 30 to 59 gives the same counter, which is why the code stays the same for half a minute and the countdown shows how much of the step is left.

Step two is the signature. The counter is written as 8 bytes, 00 00 00 00 00 00 00 01, and signed with HMAC-SHA1 using the secret as the key. The result is 20 bytes: 75a48a19d4cbe100644e8ac1397eea747a2d33ab in hex. Anyone with the secret and the time gets these exact bytes; anyone without the secret cannot predict a single one of them.

Step three, dynamic truncation, turns 20 bytes into a short number. Look at the last byte, ab. Its low four bits are b, which is 11, so the code is taken from the four bytes starting at position 11 (counting from 0): c1 39 7e ea. The top bit is cleared, so c1 becomes 41, and 41397eea read as a number is 1,094,287,082. The last eight digits are 94287082, which is the value printed in the RFC. Keep only six digits, as most sites do, and the code is 287082. The offset trick exists so the code does not always come from the same place in the signature.

That is the whole algorithm. The website does the same calculation with its copy of the secret and its own clock, and accepts your code if they agree. Most servers also accept the step before and after, which is why a clock a few seconds off still works but one a minute off does not. SHA-256 and SHA-512 variants work the same way with a longer HMAC, and some accounts use 8 digits or 60-second steps; an otpauth:// link spells all of this out, so the page reads it from the link when you paste one.

Two cautions. The secret is the account’s second factor: anyone who has it can make your codes forever, so paste only your own, and only on a device you trust. And this page is not a vault. It keeps the secret only while the tab is open, which is right for privacy and wrong for a backup. If you want to be able to recover your codes, store the secret or the setup link in a password manager, and use this page when you need a code from it.

Frequently asked questions

Is my 2FA secret sent anywhere?

No. The codes are worked out in your browser with Web Crypto. The secret lives in this page’s memory only while the tab is open. It is not uploaded, not saved in the browser and not put in the address bar.

Why does the website reject my code?

Usually the device clock is off, the secret was mistyped, or the account uses different settings, such as 8 digits or SHA-256. An otpauth:// link carries the settings, so pasting the link is safer than pasting the secret alone.

Where do I find the secret?

When you turn on two-factor login, most sites show a QR code and a link such as "can’t scan it?" that reveals the secret as text. The QR code itself holds an otpauth:// link with the secret inside.

Can I use this instead of an authenticator app?

For testing, or to recover a code when you still have the secret, yes. As a daily replacement it is weaker: anything that can read your screen or clipboard can read the code, and the page keeps nothing, so you must store the secret safely yourself.

Does it support HOTP, Steam or other kinds of codes?

It makes standard TOTP codes with SHA-1, SHA-256 or SHA-512, 6 or 8 digits, every 30 or 60 seconds. Counter-based HOTP and proprietary formats like Steam Guard are not supported.

Related tools

Your files are processed on your device and are not uploaded. You can verify this in your browser’s developer tools under the Network tab.