Stay protected with two-factor authentication

More Stories in this Series

Protect your Facebook account from hackers with two-factor authentication

Nobody likes it when their friends suddenly start spewing links to weight-loss supplements and porn on Facebook. Don't be that person. Using Facebook's two-factor authentication feature can help keep undesireables out of your account—perhaps saving some friendships.

Two-factor authentication, for the uninitiated, requires you to enter in another piece of private data in addition to your password in order to log in. This typically takes the form of a single-use security code that gets sent to your smartphone, and it can help keep your account safe in case a hacker or data thief ever gets ahold of your username and password.

Setting up Facebook's Login Approval feature takes just a couple minutes.

To start, visit and log in with your username and password. Next click the gear icon in the upper right corner, and select Account Settings from the menu that pops up. On the next screen, select Security from the list on the left, then select Login Approvals. When the Login Approvals section expands, check the box labelled Require a security code to access my account from unknown browsers, and Facebook will walk you through the setup process.

By default, Facebook will send security codes through its mobile app, but it can send you text messages as a backup login method. If you don't already have a cellphone number associated with your account, Facebook will ask you to add one. When prompted, select your country from the list, enter your number, then press Continue. Facebook will send you a text message to confirm that your number is indeed yours: Enter the six-digit confirmation code texted to you when prompted, then click Confirm.

Logging in

Facebook will not pester you to enter a security code from a browser it already recognizes, so if you only use Facebook from one computer, you may never be asked to senter a security code. But if you are, here's what to expect:

After you enter your username and password, you'll be asked to enter a security code.

The next time you log into Facebook on a new computer, enter your username and password as usual, then press Log In. On the next screen, Facebook will ask you to enter a security code.

The Code Generator in Facebook's mobile app.

To get that code, open the Facebook app on your phone, tap More (in the toolbar on iOS, swipe left to right to access the More menu on Android), then scroll down and tap Code Generator. Facebook will give you a single-use code that's good for 30 seconds (after 30 seconds, you'll be get a new code). Enter this in on your computer, then press Continue.


Facebook's two-factor authentication feature won't protect everything, though. It only asks for a security code if you attempt to log in from an unrecognized device, and it only works for login requests from Web browsers—you can log into the Facebook mobile app without having to enter a code. Still, it's better than nothing.

Shop ▾
arrow up Amazon Shop buttons are programmatically attached to all reviews, regardless of products' final review scores. Our parent company, IDG, receives advertisement revenue for shopping activity generated by the links. Because the buttons are attached programmatically, they should not be interpreted as editorial endorsements.

Subscribe to the Best of PCWorld Newsletter