Why you can trust ZDNET : ZDNET independently tests and researches products to bring you our best recommendations and advice. When you buy through our links, we may earn a commission. Our process

'ZDNET Recommends': What exactly does it mean?

ZDNET's recommendations are based on many hours of testing, research, and comparison shopping. We gather data from the best available sources, including vendor and retailer listings as well as other relevant and independent reviews sites. And we pore over customer reviews to find out what matters to real people who already own and use the products and services we’re assessing.

When you click through from our site to a retailer and buy a product or service, we may earn affiliate commissions. This helps support our work, but does not affect what we cover or how, and it does not affect the price you pay. Neither ZDNET nor the author are compensated for these independent reviews. Indeed, we follow strict guidelines that ensure our editorial content is never influenced by advertisers.

ZDNET's editorial team writes on behalf of you, our reader. Our goal is to deliver the most accurate information and the most knowledgeable advice possible in order to help you make smarter buying decisions on tech gear and a wide array of products and services. Our editors thoroughly review and fact-check every article to ensure that our content meets the highest standards. If we have made an error or published misleading information, we will correct or clarify the article. If you see inaccuracies in our content, please report the mistake via this form.


How to use Safari's built-in 2FA code generator (and why you should)

If you depend on 2-factor authentication and want to stop relying on a mobile 2FA app, Safari has the service built-in, so you can make authentication a bit more efficient.
Written by Jack Wallen, Contributing Writer
tsingha25/Getty Images

Before I dive into this, I want to make a public service announcement. I'll keep it brief.

A password manager is a much more secure method of saving/using passwords than a web browser.

There. I've said it.

Also: The best password managers to save you from login hassle

I also understand that many people simply do not want to depend on yet another app in their workflow...even if that app would improve the security of their daily lives. To that end, they'd much rather have their browser save their passwords and be done with it.

There's no shame in that. And as long as you're using strong passwords and a browser that obfuscates those saved passwords behind a master password, you should be OK. 

However, I would also recommend you use 2-factor authentication (2FA) any chance you get. And if Safari is your browser of choice, you can use 2FA without having to rely on a third-party app to generate those codes. Why? Because Safari has had 2FA built in since version 15. And for those who've hesitated to add 2FA into the mix (because of the necessity of using yet another app), this keeps everything within the browser.

But how do you use the feature? It's quite simple. Let me show you.

How to use Safari's 2FA code generator

What you'll need: The first thing you'll need is an updated version of the Safari web browser. I'm going to demonstrate this on MacOS Sonoma with Safari version 17. You'll also need a site that allows the addition of 2FA. 

Also: Why you can still trust (other) password managers, even after that LastPass mess

One thing to keep in mind is that if you've already enrolled an account with 2FA on a mobile app (such as Authy), you'll either have to unenroll from 2FA or use the current 2FA code from your mobile app. If you've not enrolled the site in question with 2FA, you can add it as you normally would, only through Safari and not your mobile app.

1. Open Safari Settings

The first thing you must do is open the Passwords section of Safari Settings. To do that, open Safari and then click the Safari entry in the Menu Bar. From the pop-up menu, click Settings.

The Safari drop-down menu.

You can also open the Settings window with the Command+, key combination.

Screenshot by Jack Wallen/ZDNET

2. Open the Passwords tab and authenticate

Next, click on the Passwords tab. You will then have to either type your user password or use Touch ID to unlock the vault.

The Password tab of the Safari Browser Settings window.

You can either type your user password or touch the fingerprint sensor on your MacBook to unlock the passwords tab.

Screenshot by Jack Wallen/ZDNET

Also: The best security keys to protect yourself and your business

3. Open the password entry in question

Locate the entry for which you want to add 2FA and double-click (or double-tap) it to open the entry. Once the entry is open, you'll see a pop-up window. In that window, locate and click Set Up to the right of the verification code.

A Safari password entry for Github.com.

You can also add notes, in case you need to keep track of extraneous information about the entry.

Screenshot by Jack Wallen/ZDNET

4. Type the verification code

In the next pop-up, you'll either type the verification code from your current 2FA enrollment or add the one presented from a new enrollment. If you're unable to view that code, you'll probably have to unenroll from 2FA on the site and re-enroll. Once you have the code type it into the field or scan the QR given to you by the service for the 2FA setup. Once you've done that, the entry is ready to go.

The 2FA set up window in Safari.

You can either use a 6-digit key or a QR code for this step.

Screenshot by Jack Wallen/ZDNET

Also: The best VPN services, tested and reviewed

5. Using the code

To use the new 2FA code, you simply log into the account in question and, when prompted for the 2FA code, click on the text area where you'd normally type the code and select the entry from Safari. You'll have to authenticate (such as using Touch ID) to ensure it is you requesting the code but that's it. 

2FA authentication in Safari.

The bottom entry is the code generated by Safari.

Screenshot by Jack Wallen/ZDNET

Instead of having to work with yet another app for 2FA, why not use Safari's built-in option? It's faster, more convenient, and still gives you that added layer of 2-Factor Authentication.

Editorial standards