Skip to content

Guide

What is two-factor authentication?

A strong password protects you until it leaks. Two-factor authentication protects you after that. Here is how the different kinds compare, and how to set it up safely.

By Mark Stoumann ·

Two-factor authentication (2FA) asks for a second proof that it’s you, on top of your password. The proofs come in three kinds, and 2FA combines two of them:

  • Something you know: a password or PIN.
  • Something you have: your phone, a security key or another device.
  • Something you are: a fingerprint or your face.

If your password leaks in a data breach or is caught by a phishing page, the attacker still needs the second factor, which is on your desk or in your pocket. That one step blocks most account takeovers, and buys you time to follow the steps after a password breach.

The kinds of 2FA, from weakest to strongest

Codes by text message or email

The site sends a one-time code to your phone number or inbox. It’s easy and needs no app, but it is the weakest option. Text messages aren’t encrypted, and in a SIM swap a criminal persuades your mobile carrier to move your number to their SIM card, so your codes go to them. NIST lists phone-based codes as “restricted”, and the US cybersecurity agency CISA advises people to move away from SMS codes. Email codes are only as safe as your email account.

Authenticator apps

An authenticator app (Google Authenticator, Microsoft Authenticator, the code features in many password managers and others) shows a code of six or more digits that changes every 30 seconds. When you turn it on, the site shows a QR code holding a shared secret; your app and the site then calculate the same code from that secret and the current time, using an open standard called TOTP. Nothing is sent to your phone, so SIM swaps don’t matter, and it works offline.

Push prompts

Some services send a prompt to their app on your phone: “Is this you signing in?” It’s quick, but attackers who have your password can send prompt after prompt until someone taps Approve to make it stop, a trick called MFA fatigue or push bombing. Many apps now show a number on the login screen that you have to type into the prompt, which CISA recommends. Never approve a prompt you didn’t start.

Security keys and passkeys

A security key is a small USB or NFC device you touch to log in; a passkey does the same job with a key stored on your phone or computer, unlocked with your fingerprint, face or device PIN. Both use the FIDO standards, and both check which website is asking before they answer, so a look-alike phishing site gets nothing. CISA calls FIDO the only widely available phishing-resistant kind of MFA. Our guide to passkeys explains how they work.

MethodStops a leaked passwordStops SIM swapsStops phishing
SMS or email codeYesNoNo
Authenticator appYesYesNo
Push prompt with number matchingYesYesPartly
Security key or passkeyYesYesYes

How phishing gets past codes

Modern phishing kits don’t just collect passwords. They sit between you and the real site: you type your password and your 2FA code into the fake page, it passes both on to the real site straight away, and keeps the session that comes back. Microsoft has documented such attacks against SMS codes, app codes and push prompts alike. Only methods that check the website’s address themselves, security keys, passkeys and a password manager’s autofill, notice the fake.

How to set up 2FA without locking yourself out

  1. Start with your email account. Every other password can be reset through it, so it needs the best protection you have. Then your password manager, your bank, and your phone’s Apple or Google account.
  2. Choose the strongest method the site offers: a passkey or security key, then an authenticator app, then SMS.
  3. Save the recovery codes the site shows you. Print them or keep them in your password manager, not in a screenshot in your camera roll. Each code works once.
  4. Add a backup. Register a second security key or passkey, or use an authenticator app that backs up its codes, so losing one phone isn’t a crisis.
  5. Remove the SMS fallback once a stronger method works, if the site lets you; otherwise a SIM swap can still get around it.

2FA doesn’t replace a good password; it backs one up. Make each password unique with the password generator, and read how to create a strong password for the rest.

Frequently asked questions

Is 2FA the same as MFA?

Nearly. Multi-factor authentication (MFA) means two or more factors; two-factor authentication (2FA) is the common case of exactly two, usually a password plus a code, a prompt or a key. Two-step verification is another name for the same idea.

Is SMS 2FA better than nothing?

Yes. A text-message code still stops an attacker who only has your password, which is how most account takeovers happen. It is the weakest kind of second factor, though, so switch to an authenticator app, a security key or a passkey where a site offers one, and remove the phone number as a fallback if the site allows it.

What happens if I lose my phone?

That is what recovery codes are for. Save them when you turn 2FA on, printed or in your password manager, and you can still sign in. Authenticator apps that back up or sync your codes, and a second security key, also help. Without any of these, you depend on the site’s account recovery, which can take days.

Can 2FA be hacked?

Codes and push prompts can be phished: a fake login page passes your password and code on to the real site in real time. SMS codes can also be stolen by moving your number to another SIM. Security keys and passkeys resist both, because they only work on the real website.

Should I put my 2FA codes in my password manager?

It is convenient, and far better than no 2FA, but it puts both factors behind one master password. For your most important accounts, especially email and the password manager itself, keep the second factor somewhere else, such as a separate authenticator app or a security key.