Skip to content

Repository files navigation

Backup Code Formatter

Clean Google backup codes and GitHub recovery codes in your browser.

Paste a copied recovery-code list, choose the source, and copy a consistent format. No uploads or accounts.

Open the live app | What it does | Run locally | Deploy your own

Live app Formatting TypeScript

Backup Code Formatter showing a formatted Google backup-code list

The preview uses made-up codes. Never post a real backup or recovery code.

What it does

Backup Code Formatter cleans pasted Google backup codes and GitHub 2FA recovery codes. It runs in the browser and formats text that was copied with inconsistent spaces, commas, or line breaks.

  • Formats Google backup codes as 0000 0000.
  • Formats GitHub recovery codes as 00000-00000.
  • Accepts spaces, commas, line breaks, and copied separators in the pasted list.
  • Warns when part of a code is incomplete or the number of codes differs from the usual set.
  • Copies the result as a comma-separated list or one code per line.

Use the formatter

  1. Open backupcodefmt.ridhoafwani.dev.
  2. Choose Google or GitHub.
  3. Paste the copied list, choose an output format, then copy it.

The app does not create, verify, recover, or replace codes. It only formats pasted text. Keep recovery codes private and store them where you can access them if you lose your second factor.

Google calls these 8-digit backup codes and normally provides 10 at a time. GitHub calls them 2FA recovery codes and provides 16 one-time codes. See the official Google backup-code guide and GitHub recovery-code guide.

Privacy and scope

The formatter processes codes in the current browser page. It has no accounts, uploads, or saved history. Clearing the field removes the codes from the page.

Do not paste real backup or recovery codes into public issues, pull requests, screenshots, or chat messages.

Run locally

Install Node.js 22.12 or newer and pnpm, then run:

git clone https://github.com/afwaniridho/backup-code-formatter.git
cd backup-code-formatter
pnpm install --frozen-lockfile
pnpm dev

Open localhost:3000. The app does not need a database or application API key.

Command Purpose
pnpm dev Start the development server
pnpm build Build the app for production
pnpm test Run the Vitest tests
pnpm check Check formatting and lint rules with Biome
pnpm deploy Build and deploy to Cloudflare Workers

Deploy your own

The project uses React 19, TypeScript, TanStack Start, and Cloudflare Workers.

  1. Install the dependencies and sign in with pnpm exec wrangler login.
  2. Edit wrangler.jsonc. Set a Worker name and replace the custom domain with one you control, or remove routes to use a Workers subdomain.
  3. Replace the public site URL in src/routes/__root.tsx, public/robots.txt, and public/sitemap.xml with your deployment URL.
  4. Run pnpm deploy.

Related project

Need a browser-based TOTP authenticator? See 2FA Manager. It generates TOTP codes in the browser and can export account data to JSON.

Contribute

Bug reports, documentation fixes, and focused pull requests are welcome. Use made-up codes in examples and reports. Do not share a real backup or recovery code.

If the formatter is useful, a GitHub star helps people find it.

About

Format Google backup codes and GitHub recovery codes in your browser. Clean pasted lists, fix separators, and copy them. No uploads or accounts required.

Topics

Resources

Stars

2 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages