Two-factor authentication is an extra layer of security for your Apple ID designed to ensure that you’re the only one who can access your account—even if someone knows your password. You can access your account can only on devices you trust, like your Mac, iPhone, iPad, or Apple Watch. When you want to sign in to a new device for the first time, you’ll need to provide two pieces of information—your password and the six-digit verification code that’s automatically displayed on your trusted devices. By entering the code, you’re verifying that you trust the new device.
You can turn on two-factor authentication when you set up a new Mac, or turn it on later in the Password & Security preferences of System Preferences. For the steps to do this, see Use two-factor authentication for security on your Mac, iOS devices, and iPadOS devices in the macOS User Guide.
For complete details on two-factor authentication, see Two-factor authentication for Apple ID.