Skip to main content
Numbers · 287 tools

TOTP Backup Code Generator

Generates one-time backup recovery codes for two-factor authentication setups

Backup Recovery CodesExample — click Generate for yours
  • pzt9-mu6x
  • xyzs-73df
  • 98tk-m465
  • fap7-eau5
  • jj9f-t8f8
  • adz8-gp87
  • vcpf-9fjh
  • yvh8-hcyr
  • g6jm-sskz
  • hyum-h7nw

Generated 10 items

See 3 examples
  • Example 1
    pzt9-mu6x
    xyzs-73df
    98tk-m465
    fap7-eau5
    jj9f-t8f8
    adz8-gp87
    vcpf-9fjh
    yvh8-hcyr
    g6jm-sskz
    hyum-h7nw
  • Example 2
    h472-mwz6
    ytkr-kbkz
    r32f-h7pp
    7eq6-pt64
    u5rx-yzgm
    emkm-8amh
    grvj-vt5k
    fz54-vvjw
    sa8w-k7hq
    d5xs-4qa8
  • Example 3
    g4qu-ygrx
    mcdb-py3k
    sm4v-sevu
    yj4r-hd3v
    3gg6-nnyy
    3jek-y8qp
    b77u-fwq7
    h9a5-2zz6
    knxa-fehx
    pqhn-3b2f

About this generator

A TOTP backup code generator lets you create one-time recovery codes that mirror what services like GitHub, Google, and Dropbox hand users during 2FA setup. Developers building custom authentication flows need realistic codes to prototype onboarding screens, test input validation, and seed staging databases before any real cryptography is involved. This generator lets you choose how many codes to produce (up to any batch size) and pick from three real-world formats: XXXX-XXXX, XXXXXXXX, or XXX-XXX-XXX. All output uses ambiguity-free characters — no O/0 or I/1/l confusion — so what you test in Figma or Storybook behaves the same way users experience it under pressure.

How to use

  1. Set the Number of Codes field to match how many backup codes your system or design requires (default is 10).
  2. Choose a Format from the dropdown — pick the pattern that matches your application's expected code structure.
  3. Click Generate to produce a full set of backup codes in the selected format.
  4. Review the list for readability, then copy the codes to use in your UI mockup, test database, or documentation.

Use Cases

  • •Seeding a staging database with 10 correctly formatted recovery codes per test user for Cypress end-to-end auth tests
  • •Populating Figma mockups of a 2FA onboarding screen with realistic XXXX-XXXX format codes before any backend exists
  • •Generating example codes for a Notion security runbook or internal documentation without exposing real account credentials
  • •Testing input mask validation and one-time-use enforcement logic in a Node.js or Django authentication module
  • •Producing dummy recovery tokens for stakeholder demos of a custom admin portal's 2FA recovery UX

Tips

  • →Match the format exactly to your production system before testing input validation — a format mismatch will give false passes.
  • →If your app displays codes in a monospace font, test your chosen format with one to catch wrapping or alignment issues early.
  • →Generate two or three sets in different formats side by side to help stakeholders agree on a standard before development begins.
  • →Numeric-only formats are easier for users to type on mobile but harder to distinguish at a glance — use alphanumeric for printed codes.
  • →When writing security documentation, use codes from this tool rather than redacting real ones — it removes any risk of accidental exposure.
  • →Pair this generator with a password strength or entropy tool when designing your full authentication system to ensure consistent security UX.

FAQ

are these backup codes safe to use in a real authentication system

No. Although the codes use the browser's cryptographic random source, real ones must be issued by your server. For real user accounts, generate codes server-side with a CSPRNG — crypto.randomBytes() in Node.js, secrets.token_hex() in Python, or your platform's equivalent. These outputs are safe for UI prototyping, QA seeds, and documentation only.

what format should 2fa backup codes use

XXXX-XXXX is the most widely recognised format — easy to read aloud, easy to transcribe, and familiar from Google and GitHub. The XXX-XXX-XXX option suits longer codes where extra grouping reduces errors. Whichever format you pick, keep it consistent across the full set and strip visually ambiguous characters like 0, O, 1, I, and l.

how many backup codes should an app give each user

Most major services default to 8 to 10 codes, which gives users enough for emergencies without creating a large attack surface if the list is stolen. Ten is the most common choice. For internal tools with a small user base, six codes with a clear regeneration flow is a reasonable minimum.

What are 2FA backup codes for?

They are one-time recovery codes that let a user regain access to an account if they lose their authenticator device or phone — each code works once, as a fallback for the normal second factor. Without them, losing the device can mean being locked out. The generator produces sets of these codes in common formats, so you can model or test a backup-code recovery flow.

How should users store backup codes safely?

Somewhere offline and separate from the device that generates their main 2FA codes — printed and kept securely, or saved in a password manager — never in plain text next to their login. The whole point is that they survive losing the phone. When building a real system, generate codes server-side with a secure library; this tool is for learning, testing, and mockups of that flow.

You might also like

Popular tools from other categories that share themes with this one.