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

1password deal blue

1Password Security Breach: What Was Accessed and What Wasn't

Wednesday November 25, 2026 1:09 pm PST by
Popular password management app 1Password today said it experienced a security breach earlier this month. 1Password says some customer names and email addresses were accessed, but no customer vault contents were compromised. On November 19, 1Password saw indications that an employee's GitHub account had been breached and began investigating. The company says the breached GitHub account was...
apple design award 2025

Apple Announces 2025 Design Award Winners Ahead of WWDC 2025

Tuesday June 3, 2025 10:14 am PDT by
As we wait for WWDC to kick off next Monday, Apple today announced the winners of its annual Apple Design Awards, recognizing apps and games for their innovation, ingenuity, and technical achievement. The 2025 Apple Design Award winners are listed below, with one app and one game selected per category: Delight and Fun - CapWords (App) and Balatro (Game) Innovation - Play (App) and PBJ -...
ipad pro prime

Apple Has iPads Running macOS Internally, Says Gurman

Wednesday November 25, 2026 4:55 am PST by
Apple has iPads running macOS internally and has had them "for some time," according to Bloomberg's Mark Gurman, although he says no work is currently being done to bring the Mac operating system to iPads. Speaking on his latest Power On podcast, Gurman said there is "no work being done to consumerize macOS on the iPad." Rather, Apple will continue to bring Mac features and apps like Final Cut ...
Latest Stories
The 50+ Best Apple Black Friday Deals on AirPods, iPads, MacBooks, and More
The 50+ Best Apple Black Friday Deals on AirPods, iPads, MacBooks, and More
32 minutes ago
Apple's M6 and PROLED MacBook Pro Reach New Low Prices for Black Friday
Apple's M6 and PROLED MacBook Pro Reach New Low Prices for Black Friday
37 minutes ago
The MacRumors Show: iPhone Air 2 and iPhone 18 Are Coming
The MacRumors Show: iPhone Air 2 and iPhone 18 Are Coming
43 minutes ago
Apple Store in Brisbane Reopening Next Month With New Design
Apple Store in Brisbane Reopening Next Month With New Design
1 hour ago
The 60+ Best Black Friday Accessory Deals on iPhone Chargers, TVs, Headphones, and More
The 60+ Best Black Friday Accessory Deals on iPhone Chargers, TVs, Headphones, and More
2 hours ago
GTA VI Now (Barely) Running on Apple Silicon Macs
GTA VI Now (Barely) Running on Apple Silicon Macs
2 hours ago
The Best Black Friday Streaming Deals on Apple TV, Disney+, and More
The Best Black Friday Streaming Deals on Apple TV, Disney+, and More
3 hours ago
Apple TV's 'Carême' Wins International Emmy for Best Drama
Apple TV's 'Carême' Wins International Emmy for Best Drama
4 hours ago
iPhone 18 Production Delay Leaves Apple Little Time Before Launch
iPhone 18 Production Delay Leaves Apple Little Time Before Launch
4 hours ago
The Best Black Friday AirPods Deals
The Best Black Friday AirPods Deals
5 hours ago
The Best Black Friday Deals on Apple Home Products
The Best Black Friday Deals on Apple Home Products
5 hours ago
The Best Black Friday iPhone Deals
The Best Black Friday iPhone Deals
5 hours ago
The Best Black Friday iPad Deals
The Best Black Friday iPad Deals
5 hours ago
The Best Black Friday Apple Watch Deals
The Best Black Friday Apple Watch Deals
5 hours ago
The Best Black Friday AirTag Deals
The Best Black Friday AirTag Deals
5 hours ago
The Best Black Friday Mac Deals
The Best Black Friday Mac Deals
5 hours ago
iPhone Share of US Smartphone Market Hits 57% as Rivals Slip
iPhone Share of US Smartphone Market Hits 57% as Rivals Slip
6 hours ago
iPhone 20 Pro Rumored to Feature 3D-Printed Titanium Frame
iPhone 20 Pro Rumored to Feature 3D-Printed Titanium Frame
8 hours ago
Apple's Official 2026 Black Friday Offer Starts Rolling Out
Apple's Official 2026 Black Friday Offer Starts Rolling Out
1 day ago
Halide Adds Fill Light Feature for iPhone Duo
Halide Adds Fill Light Feature for iPhone Duo
1 day ago
MacBook Air Black Friday Deals Now Live With Massive $399 Savings
MacBook Air Black Friday Deals Now Live With Massive $399 Savings
1 day ago
Amazon Discounts All MacBook Neo Models by $99 for Black Friday
Amazon Discounts All MacBook Neo Models by $99 for Black Friday
1 day ago
Kodak Launches Unique AirTag Rival With E-Ink Display
Kodak Launches Unique AirTag Rival With E-Ink Display
1 day ago
Here's Why the Apple Store is Going Down
Here's Why the Apple Store is Going Down
1 day ago
Apple Still Working on Giant Foldable iPad That Could Cost $5,000
Apple Still Working on Giant Foldable iPad That Could Cost $5,000
1 day ago
iPhones Dominate China's Weak Singles' Day Smartphone Sales
iPhones Dominate China's Weak Singles' Day Smartphone Sales
1 day ago
iPhone 20 Pro Could Feature Ceramic in Limited-Edition Model
iPhone 20 Pro Could Feature Ceramic in Limited-Edition Model
1 day ago
Apple Faces Korean Regulator Review Over iPhone 16 AI Advertising
Apple Faces Korean Regulator Review Over iPhone 16 AI Advertising
1 day ago
Apple Watch Ultra 4 Hits New Best-Ever Price of $649.99 for Black Friday
Apple Watch Ultra 4 Hits New Best-Ever Price of $649.99 for Black Friday
1 day ago
New Apple Store Opening in India, Download the Special Wallpaper Now
New Apple Store Opening in India, Download the Special Wallpaper Now
2 days ago
Related Apple News: Sport | Iphone | Travel | Buyers Guide | Mac