Back to blog

Online Mar 23, 2026 10 min read

How to Set Up Two-Factor Authentication Backup Codes Before You Get Locked Out

Learn how to save 2FA backup codes, add recovery options, and avoid losing account access when your phone is lost or reset.

Smartphone displaying a lock screen with security authentication prompt
Image: Unsplash License (free for commercial use, no attribution required) source

How to Set Up Two-Factor Authentication Backup Codes Before You Get Locked Out

Two-factor authentication (2FA) is one of the most effective ways to protect your online accounts. By requiring a second form of verification beyond your password, it makes it dramatically harder for attackers to break in — even if they steal your credentials. Most security experts recommend enabling it on every account that supports it.

But there is a catch that catches many people off guard: if you lose access to your second factor — your phone gets stolen, your authenticator app gets wiped after a factory reset, or your SIM card stops working — you can find yourself locked out of your own accounts. This is not a rare edge case. It happens to careful, tech-savvy people all the time.

The good news is that every major platform provides tools to prevent this exact scenario. The key is setting them up before you need them, not after. This guide walks you through everything you need to know about backup codes, recovery options, and smart 2FA habits that keep you secure without leaving you stranded.


Quick Answer

  • Save your backup codes immediately when you enable 2FA — most platforms generate 8–10 single-use codes you can store offline.
  • Add a secondary recovery method (backup phone number, secondary email, or a second authenticator device) wherever the platform allows.
  • Store backup codes in at least two places: a printed copy in a safe place and an encrypted digital copy (like a password manager).
  • Never rely on a single device for your authenticator app — use cloud backup features or register a second device when possible.
  • Test your recovery options before you actually need them so you know they work.

Why 2FA Lockouts Happen (and Why They Are More Common Than You Think)

Two-factor authentication lockouts typically happen in one of a few predictable situations:

  • You get a new phone and forget to migrate your authenticator app first.
  • Your phone is lost, stolen, or damaged beyond use.
  • You perform a factory reset without backing up your authenticator data.
  • Your phone number changes or your carrier has an outage.
  • You uninstall an authenticator app by accident.

The frustrating reality is that the very security that makes 2FA powerful is also what makes recovery difficult. Platforms cannot simply hand over access because you say you lost your phone — that would defeat the purpose. This is why preparation is everything.


Understanding Your 2FA Options

Before diving into backup strategies, it helps to understand the types of 2FA and their relative strengths and weaknesses.

2FA MethodSecurity LevelLockout RiskNotes
Authenticator app (TOTP)HighMedium-HighLost phone = lost codes unless backed up
SMS text messageMediumLowSIM swap attacks are a real risk
Hardware security keyVery HighHighLosing the key without a backup is serious
Email-based codesLow-MediumLowDepends on email account security
Backup codes (offline)HighVery LowOnly if stored safely
Passkeys / biometricsHighMediumDevice-dependent; needs recovery plan

As you can see, the most secure methods also tend to carry the highest lockout risk if you do not plan ahead. The solution is not to use weaker methods — it is to layer your recovery options intelligently.


How to Save and Store 2FA Backup Codes

What Are Backup Codes?

Backup codes are one-time-use codes generated by a platform when you set up 2FA. They are designed specifically for situations where your primary 2FA method is unavailable. Most services generate between 8 and 10 codes, each usable exactly once. After a code is used, it is invalidated.

Google, Microsoft, GitHub, Dropbox, and most other major platforms offer backup codes. When you enable 2FA, the setup flow will typically show them to you — often with a strong recommendation to save them. Many people click past this screen too quickly.

Step-by-Step: Saving Backup Codes Properly

  1. During 2FA setup, look for the option labeled “Backup codes,” “Recovery codes,” or “Emergency codes.”
  2. Download or copy the codes before closing the screen — you usually cannot retrieve the same set again without regenerating them.
  3. Print a physical copy and store it somewhere secure, such as a locked drawer, a home safe, or with other important documents.
  4. Save a digital copy in an encrypted password manager (such as Bitwarden, 1Password, or Dashlane). Do not store them in a plain text file on your desktop.
  5. Do not store backup codes in the same account they protect. Saving your Google backup codes only in Google Drive defeats the purpose.
  6. Regenerate codes if you ever suspect they have been compromised, or after you use one.

Where NOT to Store Backup Codes

  • Unencrypted notes apps synced to a single device
  • Screenshots sitting in your camera roll without a backup
  • Email drafts in the account the codes are meant to protect
  • Sticky notes on your monitor

Setting Up Secondary Recovery Methods

Backup codes are your emergency parachute, but you should also set up secondary recovery methods as a first line of defense.

Add a Recovery Phone Number or Email

Most platforms allow you to add a secondary email address or phone number as a recovery option. This is separate from your 2FA method — it is used specifically to verify your identity if you get locked out.

  • Go to your account’s Security or Privacy settings.
  • Look for “Recovery email,” “Recovery phone,” or “Account recovery options.”
  • Add a phone number or email address that you reliably control and that is different from your primary contact.

Register Multiple Devices with Your Authenticator App

Some authenticator apps — including Authy and Microsoft Authenticator — allow you to register your account across multiple devices. If you lose one device, you can still generate codes on another.

  • Authy explicitly supports multi-device sync and encrypted cloud backup. You can enable this in Settings > Devices.
  • Google Authenticator added Google Account sync in 2023, which backs up your codes to your Google Account.
  • Microsoft Authenticator supports cloud backup via your Microsoft account.

If you use an app that does not support backup or sync, consider switching to one that does, or manually export your accounts before switching phones.

Use a Hardware Security Key With a Backup Key

If you use a physical security key (like a YubiKey), best practice is to register two keys with each account — a primary and a backup. Store the backup key somewhere safe, such as a fireproof safe or a trusted location. This is standard advice from security professionals and is explicitly recommended by Google’s Advanced Protection Program.


How to Migrate Your Authenticator App to a New Phone

This is the scenario where most lockouts happen. Here is how to do it safely.

  1. Before switching phones, open your authenticator app and check whether it has a backup or export feature.
  2. Enable cloud backup if available (Authy, Google Authenticator, Microsoft Authenticator all support this).
  3. Install the authenticator app on your new phone and sign in to restore your accounts from backup.
  4. Verify that your codes are working on the new device before wiping or selling the old one.
  5. If your app does not support backup, you will need to disable and re-enable 2FA on each account individually using your old phone while you still have it.

Never factory reset or sell your old phone before confirming your authenticator is fully migrated.


What to Do If You Are Already Locked Out

If you are reading this after already losing access, here are your options in order of likelihood:

  1. Use a backup code if you saved one.
  2. Check your recovery email or phone — the platform may be able to send a verification code there.
  3. Use a trusted device — some platforms (like Google and Apple) allow you to approve a login from a device you have previously used.
  4. Contact platform support — be prepared for a lengthy identity verification process. Have government-issued ID, billing information, and account history ready.
  5. For Google specifically, the account recovery form asks questions about your account history to verify identity.

Recovery through support is not guaranteed and can take days or weeks. This is why preparation matters so much.


Pro Tip

Set a recurring calendar reminder every six months to review your 2FA settings across your most important accounts. Check that your backup codes are still saved, your recovery email is still active, and your authenticator app is backed up. Treat it like a fire drill — brief, routine, and potentially life-saving.


FAQ

What happens if I lose my phone and do not have backup codes?

You will need to go through your platform’s account recovery process. This typically involves verifying your identity through a recovery email, phone number, or by answering questions about your account history. The process can be slow and is not always successful, which is why saving backup codes in advance is so important.

How many backup codes should I save?

Most platforms generate 8 to 10 backup codes. Save all of them. Each code can only be used once, so if you have used several, regenerate a fresh set and store the new ones securely.

Is it safe to store backup codes in a password manager?

Yes, a reputable encrypted password manager is one of the best places to store backup codes digitally. Just make sure the password manager itself is secured with a strong master password and, ideally, its own 2FA method. Avoid storing codes for your password manager account inside that same password manager.

Can I use the same backup code twice?

No. Backup codes are single-use by design. Once you use a code to log in, it is invalidated immediately. After using one, it is good practice to regenerate your full set of codes and save the new ones.

Should I use SMS-based 2FA if it is the only option?

Yes, SMS-based 2FA is significantly better than no 2FA at all, despite its known weaknesses (such as SIM swapping). If a platform only offers SMS, use it — but prioritize switching to an authenticator app or hardware key on accounts where those options become available.

What is the safest authenticator app to use?

Apps like Authy, Google Authenticator (with sync enabled), and Microsoft Authenticator are all widely trusted. Authy is often recommended for its multi-device support and encrypted backup. For the highest security, a hardware key like a YubiKey is the gold standard, but it requires registering a backup key.


Conclusion

Two-factor authentication is one of the best security decisions you can make for your online accounts — but it only works well when you have a recovery plan in place. The steps are not complicated: save your backup codes somewhere secure, add a recovery email or phone number, back up your authenticator app, and test everything before you need it.

The few minutes it takes to set this up properly can save you hours — or permanent loss — of access to accounts that matter. Think of it as the digital equivalent of keeping a spare key with a trusted neighbor. You hope you never need it, but you will be very glad it exists if you do.

Start today with your most important accounts: your primary email, your password manager, and any financial or work accounts. Work outward from there. Security does not have to mean inconvenience — with the right preparation, it means peace of mind.