Skip to Content

How to Use Safari's Built-in 2FA Code Generator

by

With online account hacking becoming increasingly widespread, Mac users should make sure they're taking every security measure available to them. In other words, consider using Apple verification codes to protect your accounts. Keep reading to learn how it works.

iPhone 13 Security
One of the best ways to protect any online account is by using two-factor authentication (2FA). 2FA offers hardened security during login attempts by requesting that the user provides an extra piece of information only they would know, such as a randomly generated code from a third-party.

In macOS Monterey and later versions of its Mac operating system software, Apple's Safari browser (version 15 and later) includes a built-in two-factor authenticator that can generate verification codes for additional sign-in security. This means if a site offers 2FA, you can set up verification codes for it without downloading a third-party app.

Verification codes are backed up via iCloud, and once set up, the codes will autofill when you sign into the site using any Apple device linked to your Apple ID. This makes using 2FA on iPhone and iPad much more streamlined.

Enabling 2FA on the Account or Service

First, make sure you have the latest version of Safari (Safari 17). Once you've done that, you'll need to enable the use of a 2FA app on whichever website or service you are trying to secure. Note that if you've already enrolled an account with 2FA on a mobile app, you'll either have to unenroll from 2FA or use the current 2FA code from your mobile app.

twitter 2fa
You may need to explore the security or privacy settings of the site to enable the use of an authenticator app. On X (formerly Twitter) accounts, for example, the 2FA option is found under Settings and privacy -> security and account access -> Security.

Using Setup Keys

Once you've enabled 2FA on the account or service in question, you'll be asked to either enter a setup key on your device or scan a QR code using your device's camera. Note that you'll need to ensure that Safari's AutoFill feature is enabled (Safari ➝ Settings ➝ AutoFill) and the website's login credentials are saved in Safari for the 2FA code generator to work properly.

  1. Open Safari, then select Safari ➝ Settings... from the menu bar.
  2. Choose the Passwords tab, then either type your user password or use Touch ID to authenticate.
  3. Find and open the entry for the site you want to add 2FA to, then click Set Up next to "Verification Code," under Account Options.
  4. If the site offers a setup key, enter it in the Setup Key field. If it offers a QR code, Control-click it and choose "Set Up Verification Code". (Alternatively, you can download the QR code image and choose it using the option.)

safari verification codes

Using Safari's Generated 2FA Code

  1. Open Safari and navigate to the website that requires two-factor authentication (2FA).
  2. Enter your username and password for the website as usual.
  3. When the site asks for a 2FA code, look for Safari's built-in suggestion that appears above the input field.
  4. Click on the 2FA code suggestion. Safari will automatically generate and fill in a 2FA code.
  5. Complete the login process by verifying the 2FA code, and you're done.

In future, when you come to log in to the site or service and you're prompted for a verification code, Safari will automatically display the latest code as an AutoFill option – all you need to do is click the code to enter it into the input field, and away you go.

Popular Stories

Switch to Safari

Apple Addresses Web Security Threat, Working on macOS Update With Additional Fix

Sunday October 25, 2026 4:07 pm PDT by
Earlier this month, a security researcher discovered that private cryptographic keys associated with eight of Indian company eMudhra's intermediate certificate authority (CA) certificates were weak. The compromised keys could have allowed attackers to impersonate legitimate websites, potentially putting users' sensitive information at risk. However, there is currently no evidence that the keys...
MacBook Neo 2 on Yellow Feature

Apple Reportedly Plans to Release These Products in February or March

Sunday November 22, 2026 7:32 am PST by
Apple plans to unveil an iPhone 18e, iPhone 18, updated entry-level iPad, and new MacBook Neo and MacBook Air models around February or March next year, according to the latest word from Bloomberg's Mark Gurman. In his Power On newsletter today, Gurman said Apple has some additional products planned for the first half of 2027, including the iPhone Air 2 and new iPad Air and iPad Pro models,...
Black Friday Deals 26 4

Apple Black Friday Deals Available Now: AirPods, Apple Watches, MacBooks, and More

Saturday November 21, 2026 9:17 am PST by
Black Friday is just a few days away, taking place on Friday, November 27 in 2026. As always, this will be the best time of the year to shop for great deals, including popular Apple products like AirPods, iPad, Apple Watch, and more. Note: MacRumors is an affiliate partner with some of these vendors. When you click a link and make a purchase, we may receive a small payment, which helps us keep ...
Latest Stories
Missed That $149 AirPods Pro 3 Deal? Amazon Just Brought It Back
Missed That $149 AirPods Pro 3 Deal? Amazon Just Brought It Back
22 minutes ago
Things 3.25 for Mac Gains Touch Gestures
Things 3.25 for Mac Gains Touch Gestures
27 minutes ago
AirTag in (PRODUCT)RED?
AirTag in (PRODUCT)RED?
49 minutes ago
M6 iMacs Get First Major Discounts With Up to $111 Off at Amazon
M6 iMacs Get First Major Discounts With Up to $111 Off at Amazon
1 hour ago
Apple to Celebrate 20 Years of (RED) With Special Event in New York
Apple to Celebrate 20 Years of (RED) With Special Event in New York
1 hour ago
Hidden Coupon Deal Knocks M6 MacBook Pro to $1,779 on Amazon
Hidden Coupon Deal Knocks M6 MacBook Pro to $1,779 on Amazon
2 hours ago
Apple to Release Four (RED) Products by Next Week
Apple to Release Four (RED) Products by Next Week
2 hours ago
iPhone Air 2 and iPhone 18 Rumored to Feature Thicker Cameras
iPhone Air 2 and iPhone 18 Rumored to Feature Thicker Cameras
2 hours ago
EU in Talks With Apple Over Barriers to Rival iPhone Browsers
EU in Talks With Apple Over Barriers to Rival iPhone Browsers
2 hours ago
iPhone 18e to Get Redesigned, iPad Pro-Style Camera
iPhone 18e to Get Redesigned, iPad Pro-Style Camera
4 hours ago
iPhone Duo: 20 Tips to Get the Most Out of Apple's Foldable
iPhone Duo: 20 Tips to Get the Most Out of Apple's Foldable
4 hours ago
Meta's Muse Personal AI Agent Launches in the UK
Meta's Muse Personal AI Agent Launches in the UK
5 hours ago
OpenAI Brings GPT-6.2 Sol to ChatGPT's Chat Tab
OpenAI Brings GPT-6.2 Sol to ChatGPT's Chat Tab
17 hours ago
Google Search Gets Wallet Access, With Drive Coming Soon
Google Search Gets Wallet Access, With Drive Coming Soon
18 hours ago
Apple Store With All-New Design Opening in UK Next Month
Apple Store With All-New Design Opening in UK Next Month
19 hours ago
Apple Announces 'Ted Lasso' Renewed for Fifth Season
Apple Announces 'Ted Lasso' Renewed for Fifth Season
20 hours ago
MacBook Neo Sees Record Low $599 Price in Latest Black Friday Sale ($100 Off) [Update: Gone]
MacBook Neo Sees Record Low $599 Price in Latest Black Friday Sale ($100 Off) [Update: Gone]
20 hours ago
Grab an AirTag 2 for Just $18 at Best Buy and Amazon
Grab an AirTag 2 for Just $18 at Best Buy and Amazon
21 hours ago
Apple Bringing Back (PRODUCT)RED With Red HomePod Mini 2 and AirPods Max 2
Apple Bringing Back (PRODUCT)RED With Red HomePod Mini 2 and AirPods Max 2
21 hours ago
Best Black Friday Streaming Deals on Apple TV, Peacock, HBO Max, and More
Best Black Friday Streaming Deals on Apple TV, Peacock, HBO Max, and More
21 hours ago
Threads is Getting an iPad App
Threads is Getting an iPad App
22 hours ago
Developer Turns MacBook Trackpad Into a Speaker Using Haptic Motor
Developer Turns MacBook Trackpad Into a Speaker Using Haptic Motor
23 hours ago
A Decade Later, Apple Remains Berkshire's Biggest Stock Bet
A Decade Later, Apple Remains Berkshire's Biggest Stock Bet
23 hours ago
Black Friday Video Game Deals Include Rare Sale on Nintendo Switch 2 Mario Kart World Bundle
Black Friday Video Game Deals Include Rare Sale on Nintendo Switch 2 Mario Kart World Bundle
1 day ago
M5 MacBook Air Now Starts at $989.10 for Black Friday, Get Up to $310 Off
M5 MacBook Air Now Starts at $989.10 for Black Friday, Get Up to $310 Off
1 day ago
Apple Wallet Driver's License Feature Coming to Connecticut
Apple Wallet Driver's License Feature Coming to Connecticut
1 day ago
Coalition of 55,000 EU Businesses Challenges Apple
Coalition of 55,000 EU Businesses Challenges Apple
1 day ago
Apple Watch Series 12 Drops to $299 on Amazon
Apple Watch Series 12 Drops to $299 on Amazon
1 day ago
Apple May Be Stuck With Samsung for iPhone Duo Screens
Apple May Be Stuck With Samsung for iPhone Duo Screens
1 day ago
Jensen Huang Reinstated as Nvidia CEO
Jensen Huang Reinstated as Nvidia CEO
1 day ago