2FA Backup Codes: What They Are and How to Use Them

Backup codes are your emergency access method when your 2FA device is lost or unavailable. Without them, you could be permanently locked out of your account. Here's everything you need to know.

2FA backup codes printed and stored securely as emergency authentication method
1What They Are

What Are 2FA Backup Codes and How Do They Work?

Backup codes — also called recovery codes — are a set of one-time-use codes generated by a service when you enable two-factor authentication. They serve as an emergency authentication method for situations when your primary 2FA method is unavailable: to Spot and Avoid Attacks on Your Phone">your phone is lost, broken, or stolen; your authenticator app data is corrupted; or you changed phones without transferring your 2FA setup. Each backup code can only be used once, and using one replaces the normal 2FA requirement for that single login session.

Services typically generate between 8 and 10 backup codes when you enable 2FA. Google provides 10 backup codes, each eight characters long. GitHub provides 16 codes. These codes are generated cryptographically and are not stored in a recoverable form on the service's servers after the initial generation — they typically store only a hash of each code. This means that if you lose your backup codes, the service cannot regenerate the same ones; you must generate an entirely new set, which invalidates all previous codes.

The mechanics of backup code authentication are simple: at the 2FA prompt during login, instead of entering your authenticator app code, you click an option like "Use backup code" or "Try another method" and type one of your saved backup codes. The service verifies it against its stored hash, marks it as used so it cannot be reused, and grants you access. Most services also alert you by email when a backup code is used, which serves as a warning if you did not initiate the login.

  • One-time use: Each backup code becomes permanently invalid immediately after use
  • Typically 8–16 codes: Services generate a fixed set — Google gives 10, GitHub gives 16
  • Server-side invalidation: Used codes are immediately marked invalid and cannot be reused
  • Hash storage: Services store hashes, not the codes themselves — lost codes cannot be recovered
  • Email alert on use: Most services send a notification when a backup code is used
  • Regeneration invalidates all: Generating a new set of codes voids the entire previous set
See what to do if you're locked out and have no backup codes →
Sample 2FA backup codes showing one-time recovery codes
2Safe Storage

Where to Store 2FA Backup Codes Safely

The ideal storage solution for backup codes must satisfy two competing requirements: accessible enough that you can find and use them in an emergency, and secure enough that an attacker who compromises one part of your digital life cannot also access your backup codes. The worst option is saving them in an unsecured text file on your desktop, in your email, or in a cloud note service without encryption — if your account is compromised, the attacker finds the backup codes at the same time.

A password manager is generally the best digital storage option. Services like 1Password, Bitwarden, or Dashlane allow you to save backup codes as secure notes attached to each account entry. Since the password manager is encrypted and access-controlled independently of any single account, an attacker who compromises one account does not automatically gain access to the password manager vault. The caveat is circular: your password manager account itself should use strong 2FA, and you should have a separate recovery method for the password manager itself.

For your most critical accounts — email, banking, and any account where your entire digital identity could be compromised — a physical copy stored in a secure location is a valuable second backup. Print the codes or write them clearly on paper, put them in a sealed envelope, and store them with important documents at home (or in a safe deposit box for highest value accounts). This physical backup is immune to all digital attacks. Label each envelope clearly so you can find the right codes quickly in an emergency. Review and regenerate your backup codes when they run low to maintain a full set.

  • Best option: Password manager secure notes — encrypted, organised, and accessible across devices
  • Physical backup: Print and store in a secure location at home for critical accounts
  • Never: Unencrypted files, email drafts, unencrypted cloud notes, or screenshots without encryption
  • Never store with password: Do not keep backup codes in the same note as the account password
  • Offline storage: A home safe or locked drawer provides physical security for printed codes
  • Label clearly: Note which service and account each set of backup codes belongs to
Avoid storing backup codes in these insecure locations →
Secure storage options for 2FA backup codes — password manager and printed copy
3Using and Managing

When to Use Backup Codes and How to Manage Them

Backup codes should be used only when your primary 2FA method is genuinely unavailable — not as a convenience shortcut because your phone is in another room. Each use reduces the set available to you, and since backup codes cannot be replenished without generating an entirely new set (which voids all previous codes), treating them as precious emergency resources is the right approach. If you find yourself using them frequently, it is a sign you need to fix your primary 2FA setup rather than burning through backup codes.

After using a backup code to log in, your immediate next action should be to review and correct whatever 2FA issue caused you to need it. If your authenticator app was deleted, reinstall it and re-enroll. If you lost your phone, set up 2FA on your new device. If you changed phones without migrating, do so now. While you are logged in with a backup code, your account's 2FA is effectively reduced to just a password — you should not leave it in that state any longer than necessary.

Proactively managing your backup codes means periodically checking how many you have remaining and regenerating a fresh set before you exhaust them. For Google, you can view how many backup codes remain in your Google Account security settings and generate a new set of 10 codes at any time (which immediately voids the old set). Keep track of which codes you have used, either by crossing them off a physical list or by marking them as used in your password manager. A practical rule of thumb: regenerate backup codes whenever you have used more than half of your set.

  • Use sparingly: Reserve for genuine emergencies — each use permanently expends one code
  • Immediate follow-up: After using a backup code, restore your primary 2FA method before logging out
  • Check your count: Regularly verify how many backup codes you have remaining in account settings
  • Regenerate before empty: Generate a new set when you have used more than half of your codes
  • Void old sets: Generating new codes immediately invalidates all previous codes — store the new set
  • Per-account management: Each service has its own backup codes — manage them independently
Prevent the need for backup codes by properly transferring your authenticator →
Managing 2FA backup codes — checking count and regenerating new set
4If You Lose Them

Lost Your Backup Codes? What Happens Next

Losing both your 2FA device and your backup codes simultaneously is a worst-case scenario that can result in permanent account lockout. This is why maintaining at least two independent backups of your backup codes — one digital (password manager) and one physical (printed copy) — is so important. If you find yourself in this situation, the first thing to understand is that recovery options vary enormously by service, and some services are genuinely very strict about identity verification before bypassing 2FA.

Google provides an account recovery process at accounts.google.com/signin/recovery that attempts to verify your identity through multiple signals: trusted devices where you have previously been logged in, recovery phone number or email, location history, and account activity patterns. Success is not guaranteed — Google's security team makes a judgement call based on the available evidence. Having a recovery phone number and recovery email set up before you need them significantly improves your chances. The recovery process can take days.

For other services, the contact path is usually through their support team, which will require identity verification before granting access. Be prepared to provide: proof of account ownership (billing records, registration email, associated credit card details), government-issued ID in some cases, and detailed account history that demonstrates you are the legitimate owner. Some services — particularly those handling financial assets — may have intentionally strict recovery processes that cannot be bypassed quickly, even for legitimate owners. This is why generating and safely storing backup codes before you need them is so critical.

  • Prevention first: Always store codes in two independent locations — digital and physical
  • Google recovery: Use accounts.google.com/signin/recovery — works best on trusted devices
  • Recovery contacts: Keep a recovery phone and backup email set on all important accounts
  • Support route: Contact the service's support team with identity verification documents
  • Expect delays: Manual recovery can take 1–7 days depending on the service
  • Strict services: Crypto exchanges and financial platforms may have intentionally difficult recovery processes
Read the complete guide to recovering from 2FA lockout →
Account recovery process when 2FA backup codes are lost

Secure Your Backup Codes Before You Need Them

Check your most important accounts right now — make sure you have backup codes saved and stored in at least two secure locations.

Related VPN Articles