GitHub 2FA Code Generator

Generate your GitHub 2FA code from the setup key GitHub shows during authenticator configuration. Paste the key below — computed locally in your browser, refreshed every 30 seconds.

Codes are computed in your browser with the Web Crypto API — the key never leaves this page. Only use keys for GitHub accounts you own or are authorized to manage.

Where to find your GitHub 2FA secret key

GitHub’s 2FA setup screen has a built-in text-key option — no “can’t scan” workaround needed:

  1. Open GitHub → your profile photo → Settings → Password and authentication.
  2. Click Enable two-factor authentication, then choose Authenticator app.
  3. On the QR screen, click the “setup key” link (shown as “enter this text code”). GitHub displays the Base32 secret.
  4. Copy the key, paste it into the generator above, then type the six-digit code to confirm.
  5. Download your recovery codes before leaving the screen.

If 2FA is already enabled and you need the key again, reconfigure the authenticator app from the same page — GitHub generates a new key, which invalidates the previous one.

Why developers keep a GitHub code generator handy

GitHub prompts for the 2FA code at web logins, sudo-mode prompts for sensitive settings, and when authorizing new OAuth apps. CLI and git-over-HTTPS flows use personal access tokens instead of TOTP codes, so a browser code generator covers the web cases — including on a PC without your phone. Managing multiple GitHub accounts (work, OSS, clients)? The bulk generator handles them in one table.

GitHub 2FA troubleshooting

  • Code rejected — verify automatic time sync and enter a fresh code; full checklist at 2FA code not working.
  • Lost authenticator — use recovery codes, a passkey, or a configured security/SSH key.
  • Locked out with no recovery options — GitHub’s account recovery form can restore access after ownership verification.

Frequently asked questions

Where does GitHub show the 2FA setup key?

In Settings → Password and authentication → Enable two-factor authentication, choose the authenticator app. On the QR screen, click “setup key” and GitHub shows the secret as text to copy.

Does GitHub require 2FA?

Yes for code contributions on GitHub.com, and it is recommended for all accounts. Passkeys, security keys, and SSH keys also count as second factors.

I lost my GitHub authenticator — how do I get back in?

Use a saved recovery code, or a configured passkey, security key, or SSH key. If none are available, GitHub support’s account recovery form can restore access after verification.

Related tools and guides