On this page
Facebook calls the six-digit number it asks for after your password a login code. If you turned on two-factor authentication with an authentication app, that code comes from a secret key Facebook gave you during setup. Paste the key into the generator above and it produces the same rotating code your phone app would, refreshed every 30 seconds.
This is handy when your phone is out of reach, has a flat battery, or you want to confirm a freshly saved key actually works. Everything runs locally in your browser using the standard TOTP algorithm, so the key is never uploaded. Treat the page as a convenience, though: keep the same key stored in an authenticator app or password manager as well.
How to find your Facebook secret key
- Open Facebook and go to Settings & privacy → Settings → Accounts Center → Password and security → Two-factor authentication. Menu names can vary slightly between the app and the desktop site.
- If several profiles are linked in Accounts Center, choose the Facebook account you want to protect.
- Select Authentication app as your security method and continue.
- Facebook shows a QR code. Instead of scanning it, use the option to copy the text key shown with it. That string is your secret setup key.
- Save the key somewhere private, such as a password manager, before you move on. Facebook will ask for a code generated from it to confirm setup.
How to log in to Facebook with the code
- Paste the setup key into the secret key field of the generator at the top of this page. Spaces in the key are fine.
- Copy the 6-digit code it displays. The countdown shows how long that code stays valid.
- Return to Facebook and enter the code to finish turning on two-factor authentication. Later, whenever Facebook asks for a login code, generate a fresh one the same way.
Facebook 2FA tips
- Once 2FA is on, revisit the Two-factor authentication page and look for Recovery codes. Download or write them down; each one works a single time if you lose your key.
- If Facebook says your login code is incorrect, make sure your computer's clock is set automatically. TOTP codes depend on accurate time, and a drift of a minute or more can break them.
- Facebook can remember a browser so it stops asking for a code there. Only allow that on your personal devices, never on shared or public computers.
Your Facebook key is processed only in this browser and is never uploaded. Keep a copy in an authenticator app or password manager as well.
Facebook 2FA FAQ
Is this the same as Facebook's Code Generator?
Facebook once had a Code Generator built into its mobile app. This tool does the same job through the standard authenticator-app method: given your setup key, it calculates the 6-digit login code Facebook expects. It works with any key Facebook issues when you choose an authentication app for 2FA.
Where do I find my Facebook secret key if 2FA is already on?
Facebook does not display the key again after setup. If you did not save it, open Two-factor authentication in Accounts Center, remove the authentication app method and add it again. Facebook issues a new key, and codes from the old one stop working.
Is it safe to paste my Facebook key here?
The code is calculated in your browser with JavaScript and the key is not sent to our servers. Even so, anyone holding your key can produce your login codes, so use this only on a device you trust and never share the key with anyone.
What if I lost both my key and my recovery codes?
Check whether you are still logged in on another phone or computer, because you can manage 2FA from there. Otherwise use Facebook's official account recovery flow, which may ask you to confirm your identity. This generator cannot bypass 2FA; it only works with a key you already have.