2FA Code Generator

Runs in your browser. Nothing is sent to us. Is it safe?

A 2FA code generator gives you the six-digit code that a website asks for after your password. If a site has handed you a setup key, you can paste it here and get working codes in your browser in under a minute, without installing anything or creating an account.

What you need

One thing: the setup key (also called a secret key or seed) that the website showed when you turned on two-factor authentication. It looks like a run of letters and numbers, for example JBSWY3DPEHPK3PXP, sometimes broken into groups of four. A real key is yours alone; treat it like a password.

How to get your 2FA code

  1. Open the site's 2FA setup. In the account's security settings, choose "authenticator app".
  2. Reveal the key. Click "can't scan the code?" or "enter the key manually" and copy it. If you only see a QR code, scan, upload, paste or drop it into the generator instead, or use the QR code reader.
  3. Paste the key. Paste it into the generator at the top of the page.
  4. Get your code. The 6-digit code appears immediately, with a countdown to the next one.
  5. Copy it into the website. Press the big Copy button, paste the code into the site, and finish by saving the website's recovery codes.

There is no account and no passphrase, and the key is held in page memory only. Press Clear when you are done and it is wiped. If you will need the account again, press "Save to my accounts" to keep it in the optional encrypted vault.

What is happening behind the screen

The website and the generator share a secret. Every 30 seconds, each one mixes that secret with the current time and arrives at the same six digits. The site never has to send you the code, and you never have to send the secret back, which is why this is more resilient than a code sent by text message.

That also explains a few common surprises. If your device clock is wrong, the digits will not match. If you typed the key wrongly, they will be different from the first code. And if two people hold the same key, both get valid codes, which is exactly why the key must stay private.

Keep a backup, and keep your recovery codes

Authenticators fail in boring ways: a phone is lost, a browser's data is cleared, a passphrase is forgotten. Plan for that on the day you set up:

  • Save the recovery codes the service gives you, offline or in a password manager.
  • If you use the vault, export an encrypted backup from 2Fa Live and store it away from this device. See how to move your accounts for a step-by-step look.
  • Do not photograph QR codes and leave them in your gallery. A QR code contains the key.

Common mistakes to avoid

  • Copying the key with a trailing space or a line break.
  • Pasting the account name into the secret field, or the secret into the name field.
  • Re-enabling 2FA on a service and keeping the old key. The newest key is the only valid one.
  • Forgetting to confirm with a code on the website, so 2FA is never actually switched on.

Choosing the right tool

You have Use
A setup key (letters and numbers) This page, or the TOTP generator if you need to adjust digits, period or algorithm
A QR code on screen or in an image QR code reader
An otpauth:// link otpauth URI decoder
A hardware or counter-based token HOTP generator

Is it safe?

Your key stays in page memory in instant mode and is never sent to our server. If you save accounts, they are encrypted with your passphrase (PBKDF2-SHA256 and AES-GCM-256) and stored only on your device. This page has no ads and no analytics. A browser authenticator is only as safe as the device it runs on, and we spell out what that means, including how to check for yourself in your browser's network panel, in Is it safe?.

If you are setting 2FA up for the first time, our step-by-step guides show where each service keeps its key.

Frequently asked questions

What is a 2FA code generator?

It is a tool that produces the short code a website asks for as your second login step. It calculates the code from a secret key that the website gave you when you turned on two-factor authentication.

Where do I get the secret key?

On the website's two-factor setup screen. Next to the QR code you will usually find a link such as "can't scan the code?" or "enter this key manually". Click it and copy the key.

Is a 2FA code the same as an SMS code?

No. An SMS code is created by the service and sent to your phone. A code from an authenticator is calculated on your own device from a secret you hold, so nothing travels over the phone network.

Can I use one generator for many accounts?

Yes. Press "Save to my accounts" to keep each account in the optional encrypted vault with a clear name, and every saved code appears in one list with its own countdown.

I lost my phone. Can I still get my codes?

If you saved the setup key or an encrypted backup, yes. Add the key here, or restore the backup on a new device. If you have neither, use the recovery codes the service gave you, or its account recovery process.

What if the website gave me only a QR code?

Use the QR code reader. It can read the QR code with your camera or from an image, and it extracts the secret for you.

Will the codes match the ones from my old authenticator app?

Yes, if you enter the same secret with the same settings. Both apps run the same standard, so they produce the same code at the same time.

Is it safe to type my secret key into this page?

The page works in your browser and does not send the key to our server. We show you how to verify this in your browser and describe the limits honestly on the safety page.

Optional

Save accounts in an encrypted vault (optional)

Want your codes kept on this device? Create a vault protected by your passphrase. Skip it if you only need a code right now.