2FA Code Generator › Guides › X / Twitter 2FA

X (Twitter) 2FA Code: Use an Authentication App

By Md Rasel Mahamud · Last updated:

Reviewed for accuracy by the 2FA team

Hijacked X accounts are often used to post scams to everyone who follows them. Two-factor authentication with an authentication app is a strong, free way to protect yours. Here is how to set it up and get your X (Twitter) 2FA code.

Published 30 November 2026

X 2FA methodsHow to turn on 2FA on XGet your X 2FA code in the browserYour X backup codeThird-party apps and several…Protect your X account from…FAQ

X 2FA methods

X supports several two-factor authentication methods, such as an authentication app, a security key and, for some accounts, text messages. X has limited text-message 2FA in recent years, so an authentication app is usually the most practical choice for most people. It works with any standard TOTP authenticator.

How to turn on 2FA on X (Twitter)

  1. Open X and go to Settings and privacy.
  2. Open Security and account access, then Security.
  3. Choose Two-factor authentication.
  4. Select Authentication app and confirm your password.
  5. X shows a QR code. Look for an option to show the key as text if you cannot scan it, and save the key.
  6. Enter the 6-digit code from your authenticator to finish, then save the backup code X shows.

Menu names can change over time. If a step looks different, search the service's official help pages for "two-factor authentication".

Get your X 2FA code in the browser

  1. Open the 2FA code generator in a new tab.
  2. Paste the X key into the box, or click Scan QR or the upload button to read the QR code.
  3. Your 6-digit X 2FA code appears instantly, with a countdown to the next code.
  4. Copy the code and enter it in X before the timer runs out.

This is useful for social media managers who post from a computer, as long as the key is kept private and the browser is not shared.

Your X backup code

X provides a backup code when you turn on two-factor authentication, and you can view it again in the two-factor authentication settings while logged in. Store it offline. It lets you log in if you lose access to your authenticator.

If you are locked out without a backup code, use X's official login help. Our guide on recovering a 2FA account covers the general steps.

Third-party apps and several devices

X asks for your 2FA code when you log in on a new device or browser. Apps you connected to your account earlier, such as scheduling tools, usually keep working because they were authorised separately. If you manage several accounts, give each one its own saved entry in your authenticator with a clear name, so you never enter a code for the wrong account. Review active sessions in your security settings from time to time and log out of devices you do not use.

Protect your X account from takeovers

Our 2FA code generator is an independent tool and is not affiliated with X Corp. or Twitter.

Frequently asked questions

How do I get my Twitter (X) 2FA code?
Open the authentication app you linked to X, or paste the same X key into our 2FA code generator to see the current 6-digit code.
Where is two-factor authentication on X?
It is under Settings and privacy, then Security and account access, then Security. Menu names can change over time.
Do I need X Premium for 2FA?
No. An authentication app and security keys can be used without a subscription. Text-message 2FA has been limited, which is why an authentication app is recommended.

Ready to get your 2FA code?

Paste your secret key or scan a QR code – free, private and instant.

Open the 2FA Code Generator