Skip to content
OTP Generator

X (Twitter) 2FA code generator

Paste your X (Twitter) two-factor secret key to get the current 6-digit login code, the same one your authenticator app shows.

Find it under “Can’t scan the QR code?” when you turn on 2FA. Only have the QR?

2Your code will appear here
Paste a key to start
Calculated in your browser. Your key is never sent anywhere.
On this page

X, formerly Twitter, limits text-message two-factor authentication to paid subscribers, so most people secure their accounts with an authentication app instead. That method is free and gives you a secret key during setup. Paste it into the generator above and you will see the 6-digit code X asks for after you enter your password.

Because X accounts are frequent targets for hijacking, an authenticator-based login is worth having. This page computes each code on your own device without sending the key anywhere. It is a convenient extra, not the only place your key should live: store it in an authenticator app or password manager and keep the backup code X provides.

How to find your X (Twitter) secret key

  1. On X, open Settings and privacy → Security and account access → Security → Two-factor authentication. On mobile, start from the profile menu; labels may vary slightly.
  2. Select Authentication app and confirm your password when prompted.
  3. Choose Get started. When X shows a QR code, select the option that you can't scan it to display the text key.
  4. Copy the key and save it privately. X will ask for a code to prove the key works.

How to log in to X (Twitter) with the code

  1. Paste the X key into this generator.
  2. Copy the 6-digit code and enter it in X's confirmation box before the timer runs out.
  3. Finish setup and save the backup code X shows. On future logins, generate a new code here whenever X asks for one.

X (Twitter) 2FA tips

  • X displays a backup code at the end of setup and keeps one available under Two-factor authentication. Store it outside your phone; it is your lifeline if you lose the key.
  • If you previously used SMS 2FA and lost access to it, switching to an authentication app is the free route to keep 2FA on.
  • Third-party apps connected to your X account keep working after you enable 2FA, but review them under Connected apps and remove anything you do not recognise.

Your X (Twitter) key is processed only in this browser and is never uploaded. Keep a copy in an authenticator app or password manager as well.

X (Twitter) 2FA FAQ

Is authenticator-app 2FA free on X?

Yes. X restricted SMS-based two-factor authentication to subscribers, but the authentication app and security key methods remain available to everyone. This generator works with the authentication app method. Security keys are an even stronger option if you want to add one later.

Does this work for accounts still branded as Twitter?

Yes. Twitter and X are the same service, and the authentication app keys issued under either name follow the same TOTP standard. Any key you saved from the Twitter era still produces valid codes as long as 2FA has not been reset.

X says my code is wrong. What should I check?

Confirm your computer's time syncs automatically, make sure you copied the full key with no missing characters, and use the code shown right now rather than one you copied earlier. If you have re-enabled 2FA since saving the key, you need the new key.

I lost the key and the backup code. Can I recover my account?

Try any device that is still logged in, where you can turn off or reset 2FA. Otherwise contact X through its official help center for account access issues. This tool cannot bypass 2FA without the original key.

Get your X (Twitter) code

Paste the X (Twitter) setup key and copy the current 6-digit code in seconds.