Lose your phone and your sign-in can lock you out for good, unless you saved a spare. A recovery backup codes generator creates a list of single-use codes that let you back into an account when your usual second step fails, so you keep control of your own login even after a lost device. Most 2FA setups on Google, GitHub and Microsoft offer this option, and one spare backup code is the cheapest insurance you can buy.
Recovery Backup Codes Generator: What You Get
A generator like this hands you a numbered set of secrets, usually between eight and twelve, that you store away from your phone. Each one works as a stand-in for the code your device would normally produce. Think of the set as a spare house key: you hope never to use it, yet it decides whether a small problem stays small. Your security depends on how well the codes are made and how carefully you keep them, and the generator handles only the first part. The rest is up to you and to the platform that checks them. Open source word lists with a clear license back the multilingual passphrase generator, which avoids guessable dictionary complexity and breaches of trust.
Backup codes versus an authenticator code
An authenticator code comes from an authenticator app, changes every 30 seconds and proves you hold your device right now. Backup codes are one-time-use codes created in advance, so they stay the same until spent. Because a backup code is static, it is a stronger target for thieves than a rotating verification code, and you should guard it like a password. A text message by SMS is a third route, but it fails when you change numbers or lose the handset. Every 2FA method has a weak spot, which is exactly why a typed, offline spare earns its place next to the others in your account security settings.
Why 2FA recovery matters after a lost phone
Two-step sign-in protects your account only while you still own the second factor. After a lost phone, many people lose access to every service tied to that device and end up locked out with a correct password. A saved set of codes is your last resort: with 2FA turned on and codes in a drawer, you can recover in a minute instead of waiting days on a support queue. Two-factor authentication is only as good as its recovery path, and two-factor authentication without a spare locks out careless users first, so treat the spare list as part of the setup, not an afterthought.
How Random Recovery Codes Are Built
Good recovery codes are produced by a cryptographic random source, not by a pattern or a date. A solid generator draws each symbol independently from a fixed alphabet, which keeps every code unique and impossible to predict from the ones before it. The best tools run client-side inside your browser, so the list never travels over the network. The service that receives the codes should store only a hash of each one, never the readable text, which means even its own staff cannot read your list back. Using the EFF word list, the free diceware passphrase generator gives about 12.9 bits per word, so six words resist guessing for a very long time.
Do not confuse this with TOTP, short for time-based one-time password. A TOTP app mixes a shared secret key with the current time, so your authenticator app and the server compute the same six digits without talking. A backup code uses no clock and no shared secret key at all; it is simply an unguessable value the server remembers. That difference explains why codes still work when your phone clock is wrong or the TOTP app is gone, and why you must guard the list like a secret key.
The entropy formula for each code
The strength of a code is measured in bits of entropy. You multiply the code length by the base-2 logarithm of the symbol pool:
Here L is the number of characters and N is the alphabet size. A short 8-character numeric code has only about 26.6 bits, which is why NIST describes such a look-up secret as acceptable only when the service limits how fast you can guess. Longer codes from a bigger alphabet raise the figure quickly. That platform-side rate limit matters as much as the code itself.
Worked example: ten 10-character codes
Say the generator behind your backup list uses a 32-symbol alphabet (digits 2-9 and capital letters without look-alikes such as O and I) and makes ten codes of ten symbols. Then \(H = 10 \times \log_{2}(32) = 10 \times 5 = 50\) bits, or 1,125,899,906,842,624 possible values per code. A sample from that format looks like M5ZLDE74XZ. A blind crack attempt against your account faces ten live recovery codes, so an attacker needs about 1.1 × 1014 guesses on average before one lands. At a throttled five tries per second that is roughly 714,000 years.
| Code format | Symbols (N) | Length (L) | Strength in bits |
|---|---|---|---|
| Numeric, 8 digits | 10 | 8 | 26.6 |
| Letters and digits, length 10 | 32 | 10 | 50.0 |
| Letters and digits, length 12 | 32 | 12 | 60.0 |
| Letters and digits, length 16 | 32 | 16 | 80.0 |
Generate Backup Codes Step by Step
When you make a set for the first time, the generated backup codes appear once and the service may never show them again. Plan to save them before you close the page. If you build your own set with a backup code generator, pick the length and count first, then confirm each code is numbered so you can track what you have used. Every platform handles this slightly differently, but the flow is the same: authenticate, create, save, confirm.
Set up 2FA from your sign-in settings
- Open your account 2FA security page and find the authentication method list.
- Turn on 2FA if it is off, then choose the backup option inside the 2FA menu.
- Confirm your identity with your password or a current verification prompt.
- Copy, download or print the codes, then mark the set as saved.
Many sites also email you a notice after codes are created, so check that your email account is secure too. If the platform asks you to enter one code to prove you saved the list, do it right away, because an unconfirmed set may not work later. Your account is only protected once the platform has accepted the codes. Check the 2FA page again later to confirm the set shows as active, and add a phone number for SMS as one more fallback.
Compare MFA options: TOTP, passkey and security key
Multi-factor authentication comes in several forms. TOTP codes come from the algorithm behind every TOTP generator and authenticator app, and they depend on your secret key plus the clock. A passkey or hardware security key uses public-key cryptography and needs no typing. Each 2FA option can be lost with its device, so a typed, offline backup list remains the only one that survives a dead battery. Pair your main two-factor authentication method with a spare, and ideally store a second MFA choice besides codes. Facebook and Instagram, for instance, let you register both a hardware key and a code list for 2FA.
Store Your Backup Codes Safely
Where you keep backup codes decides whether they protect you or become a liability. Anyone who finds a valid, unused code can sign in as you in the same place you would, which makes 2FA backup storage as important as the password itself. Keep a copy that is separate from your phone and separate from the account they unlock. With 2FA on, a spare backup code kept in the same notes app as your password defeats the purpose of having two factors.
Password manager or paper copy
An encrypted password manager is the easiest home for your one-time codes, since it syncs across devices and protects the text behind a strong master password. A printed sheet of the codes in a locked drawer or a safe works as a second copy, and you mark off each entry as you spend it. If you write down codes by hand, keep the paper away from the monitor. Save the set under the name of the service so you can find those codes quickly later.
What you should never do with a code
- Do not store the list in the same email inbox that receives the reset links.
- Do not paste codes into an SMS draft or a notes app that syncs to an unlocked browser on a shared computer.
- Do not share a code with anyone claiming to be support, because no honest platform asks for one.
- Do not reuse a spent code; cross off each entry once it is used once.
What to Do When You Lose a Recovery Code
Losing a single recovery code is not an emergency, but losing the whole list while your phone is also gone is. Treat the two cases differently, since account recovery for a missing list is slower than a quick swap, because the fix depends on whether you can still sign in anywhere. In both cases, act before the next login attempt and before any 2FA lockout, since the one-time nature of each backup code means a stolen entry may already be spent.
Replace codes while you still have access
If one session is still open, go to your security settings and regenerate the list. Most services issue new codes and immediately disable the old ones, so any compromised copy stops working the moment you confirm. Download the replacement codes before leaving the page, and destroy the old paper. Some systems issue a fresh batch automatically after you spend the last code, so watch for that notice.
When a locked-out account needs account recovery
If you can no longer sign in at all, backup codes cannot help and you must use the service's own account recovery flow, which may ask for ID, a waiting period or a verified email or extra verification step. A hacker who changed your password has the same effect as a lost device, so report the takeover rather than trying codes repeatedly. Repeated wrong attempts can trigger a lock, which delays recovery further. Be wary of any site or caller promising to restore your account for a fee, since the real recovery path is always inside the platform's own security pages.
Using a Backup Code Generator Before a Handset Upgrade
I am upgrading my handset on Friday and want zero chance of a lockout when the old handset is wiped. Before touching the new one, I open my mail provider's security page, which still lists the old TOTP app, and generate backup codes. It issues 12 numeric codes of 8 digits, labelled 1 to 12.
Using the strength formula from the worked example above, 12 live eight-digit codes average about 8.3 million guesses. The number to watch is the provider's attempt limit, not the bit count: at 10 tries per hour that is roughly 95 years, but at 1,000 tries per second it is about 2.3 hours. Switching to ten-symbol codes from a 32-symbol alphabet pushes the same attack to about 2,970 years.
I recomputed both figures by hand, and they match. The edge case is a leaked database of hashed codes: an attacker checking offline faces no rate limit, so an 8-digit backup code would fall in seconds. NIST treats these as look-up secrets that lean on throttling, which is why I will not trust short numeric codes alone for an account holding money. I store the list in my password manager, print one copy for the safe, and on Saturday I will use code 3 to sign in on the new handset, cross it off, add the new authenticator app, then regenerate the set so the old paper is dead.
One-Time-Use Codes on Google, GitHub and Microsoft
Every major service offers its own version of 2FA backup codes, with different counts and rules. Always read the page for your provider before you rely on the set, and remember that a Google, GitHub or Microsoft account may each use a different recovery flow.
Google Account
A Google Account issues ten 8-digit codes from its 2-step verification page. Each works once, and creating a new set cancels the old one, so keep only the latest list; losing 2FA codes here means a slower Google recovery path. Because Google ties these codes to your account rather than to a single device, they still work wherever you log in, and the same 2FA page lists your other Google recovery options.
GitHub
GitHub calls them recovery codes and urges you to download them when you enable two-factor authentication, and its 2FA page repeats that advice. If you lose them along with your device, only a support request restores access, so store the file with your other developer credentials and re-download it after any change to your authentication settings.
Microsoft and Meta 2FA settings
A Microsoft account relies on a single static recovery code that you replace when you want a fresh one. Facebook and Instagram hand out lists under their security and login settings. Check each service for its count and its authentication rules, since a Microsoft or Instagram recovery step may differ, because rules change, and make a new set whenever you update your phone number or switch authenticator app.
Frequently Asked Questions
- What format are these codes in?
- Each code is two 5-character alphanumeric groups separated by a hyphen (e.g. "a3f9k-7bq2m") -- the same general shape used by Google, GitHub, and most other services' account-recovery backup codes.
- Can I use these codes with my Google/GitHub/etc. account?
- No -- these are standalone, cryptographically random codes for you to store as your own recovery mechanism (e.g. alongside a self-hosted 2FA setup, a password manager, or any system that lets you register custom backup codes). They aren't linked to any specific service's account -- only that service's own "generate backup codes" feature produces codes it will actually accept.
- How should I store these codes?
- Somewhere separate from the device that normally provides your 2FA codes -- printed and kept in a safe place, saved in a password manager's secure notes, or written down and stored with other important documents. If they're stored on the same device as your authenticator app, losing that device loses both your primary and backup access at once.
- Does each code work more than once?
- That depends on the system you register them with -- most 2FA implementations treat backup codes as single-use, marking each one as spent after it's used, which is why this tool generates a full set of 10 by default rather than just one.
- Are the generated codes sent anywhere?
- No. They're generated entirely in your browser using the Web Crypto API's cryptographically secure random number generator -- nothing is transmitted to a server or stored once you navigate away, so make sure to save them somewhere before leaving this page.