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
The preview uses made-up codes. Never post a real backup or recovery code.
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.
- Open backupcodefmt.ridhoafwani.dev.
- Choose Google or GitHub.
- 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.
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.
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 devOpen 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 |
The project uses React 19, TypeScript, TanStack Start, and Cloudflare Workers.
- Install the dependencies and sign in with
pnpm exec wrangler login. - Edit
wrangler.jsonc. Set a Worker name and replace the custom domain with one you control, or removeroutesto use a Workers subdomain. - Replace the public site URL in
src/routes/__root.tsx,public/robots.txt, andpublic/sitemap.xmlwith your deployment URL. - Run
pnpm deploy.
Need a browser-based TOTP authenticator? See 2FA Manager. It generates TOTP codes in the browser and can export account data to JSON.
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.
