You can regain access to your MacBook through your Apple ID, a recovery key, or another admin account

If you have forgotten your MacBook password, you are not locked out permanently. macOS gives you several paths back in, depending on what you set up before you forgot it. The fastest route is usually your Apple ID — the same account you use for the App Store or iCloud — because Apple can verify your identity through recovery codes or a trusted device. If you do not have access to your Apple ID, a recovery key you saved earlier, or another admin account on the Mac, you will need to erase the drive and set up the Mac fresh, which means losing files unless you have a backup.

The method you use depends on what you prepared in advance. Start by trying the Apple ID route, since most people have one linked to their Mac. If that does not work, check whether you saved a recovery key when you first set up two-factor authentication. If neither of those options is available, your only path forward is to boot into Recovery Mode and erase the drive.

Key Takeaways

  • Your Apple ID is the fastest way back in if you remember the password and have access to a recovery code or a trusted device.
  • A recovery key — a 28-character code you may have saved when setting up two-factor authentication — can reset your password without needing your Apple ID password.
  • Another admin account on the same Mac can reset your password through System Settings without erasing anything.
  • If none of those options are available, you must erase the drive in Recovery Mode and set up the Mac from scratch, which deletes all files unless you have a Time Machine backup.
  • The entire process takes between 5 and 30 minutes depending on which method works for you.

Using your Apple ID to reset your password

When you see the login screen and have entered your password incorrectly several times, macOS will offer you the option to reset it using your Apple ID. Click the question mark or the "Reset Password" button that appears, then enter your Apple ID email address and password. macOS will ask you to verify your identity — this usually means entering a six-digit code sent to a trusted device (like your iPhone) or answering security questions you set up with Apple.

Once you have verified your identity, you can create a new password for your Mac. This new password does not have to match your Apple ID password — they are separate. Write down the new password somewhere safe before you log in, because you will need it the next time you start your Mac. If you do not have a trusted device nearby or cannot receive the verification code, you will need to try the recovery key method instead.

Using a recovery key if you have one saved

A recovery key is a 28-character code that Apple gives you when you turn on two-factor authentication for your Apple ID. If you saved this code in a safe place — a password manager, a printed document, or a note in a find location — you can use it to reset your password without needing your Apple ID password or a trusted device.

At the login screen, click the question mark or "Reset Password" button and select the option to use a recovery key. Enter the recovery key exactly as it appears, including the hyphens. macOS will verify the key and let you create a new password. If you never saved your recovery key or cannot find it, move on to the next method.

Asking another admin account to reset your password

If another person has an admin account on the same Mac, they can reset your password without erasing anything. Have that person log in with their account, then open System Settings and go to General > Users & Groups (or Users & Groups in older macOS versions). They should click the lock icon to unlock the settings, then select your account and click "Reset Password." They can set a temporary password for you, which you can change to something you prefer the next time you log in.

This method works only if the other admin account still exists on the Mac and that person remembers their own password. If you are the only admin account or the other admin has also forgotten their password, this route is not available.

Erasing your drive and starting over in Recovery Mode

If you cannot use your Apple ID, do not have a recovery key, and no other admin account exists on your Mac, you will need to erase the drive and set up macOS fresh. This deletes all files on the Mac unless you have a Time Machine backup or another backup method. Start by shutting down your Mac completely. Then turn it back on and when ready hold down Command + R (or Command + Option + R for an older or internet-based recovery) until you see the macOS Utilities window.

In the Utilities window, click Disk Utility, select your main drive (usually called "Macintosh HD"), and click Erase. Choose a name for the drive and leave the format as APFS (or Mac OS Extended if you are on an older Mac). Click Erase again to confirm — this cannot be undone. Once the drive is erased, quit Disk Utility and select "Reinstall macOS" from the Utilities window. Follow the on-screen steps to read and install a fresh copy of macOS. When setup is complete, you can create a new account and password.

Restoring files from a Time Machine backup

If you erased your drive and have a Time Machine backup, you can restore your files after you set up the Mac with a new password. During the initial setup after erasing, macOS will ask whether you want to restore from a backup. If your backup drive is connected, select it and choose the most recent backup. macOS will restore your files, applications, and settings — but not your old password, since you just created a new one.

If you did not have Time Machine running before you forgot your password, your files are gone. This is why setting up Time Machine before you have a problem is important. If you do not have a backup and cannot recover your files through other means, you will need to accept the data loss and move forward with your new setup.

Preventing this from happening again

Once you are back into your Mac, take steps to avoid this situation in the future. Turn on two-factor authentication for your Apple ID if you have not already — go to System Settings, click your name at the top, then select Password & Security. When you enable two-factor authentication, Apple will give you a recovery key. Write this key down or save it in a password manager like iCloud Keychain, 1Password, or Bitwarden. Do not store it only in your email or on your Mac, because you may not be able to access either one if you forget your password.

Set up Time Machine to back up your Mac automatically. Connect an external drive, open System Settings, go to General > Time Machine, and click "Add Backup Disk." Select your external drive and let Time Machine run. It will back up your entire Mac every hour, keeping older backups until the drive fills up. If something goes wrong — whether a forgotten password, a hardware failure, or accidental deletion — you can restore everything from your most recent backup.

Frequently Asked Questions

How long does it take to reset my password using my Apple ID?

If you have a trusted device nearby and can receive a verification code, the entire process takes about 5 to 10 minutes. If you need to answer security questions or wait for codes to arrive, it may take 15 to 20 minutes. Erasing your drive and reinstalling macOS takes 30 minutes to an hour depending on your internet speed and Mac model.

Will I lose my files if I use my Apple ID to reset my password?

No. Resetting your password through your Apple ID, a recovery key, or another admin account does not erase anything. You keep all your files, applications, and settings. Only the erase-and-reinstall method in Recovery Mode deletes files, and only if you do not have a Time Machine backup to restore from.

What if I do not remember my Apple ID password either?

Go to iforgot.apple.com on another device and follow Apple's steps to reset your Apple ID password. You will need to verify your identity using a recovery code, a trusted device, or security questions. Once you have reset your Apple ID password, return to your Mac and use the new password to reset your Mac password.

Can I use my iPhone or iPad to reset my Mac password?

Not directly. However, if your iPhone or iPad is a trusted device linked to your Apple ID, you can receive the verification code on that device when you try to reset your Mac password using your Apple ID. The code appears on your iPhone or iPad, and you enter it on your Mac to complete the reset.

What should I do if I cannot find my recovery key?

If you cannot find your recovery key and do not have access to your Apple ID or another admin account, your only option is to erase your drive in Recovery Mode and set up macOS fresh. Before you do that, check your email for any message from Apple that might include the recovery key, and check any password managers or note-taking apps where you might have saved it.