Forgot Your Mac Password?
There are four ways back into a Mac you're locked out of. Which ones are available depends on choices made before you got locked out, so work down the list in order.
Before anything else, try the obvious. macOS doesn't tell you when Caps Lock is on at the login window, and it doesn't tell you that you're typing into the wrong user account either. Check both. Also try your Apple ID password, because plenty of people set the two to match and then forget they did.
Still stuck? Work down these in order.
1. Reset with your Apple ID
Get the password wrong three times and macOS offers to reset it with your Apple ID. Take that option, sign in, and you'll be asked to set a new password.
This only appears if the account was linked to an Apple ID and the option was enabled when the account was created. If you don't see it after three failed attempts, it isn't available and you should move on.
One catch that surprises people: resetting this way creates a new login keychain. Your old one still exists but its password no longer matches, so Safari passwords and saved Wi-Fi networks appear to vanish. They're recoverable in Keychain Access if you remember the old password, which you probably don't. Budget some time for re-entering things.
2. Use another administrator account
If someone else has an admin account on the same Mac, or you set up a second one years ago and forgot, this is the cleanest route. Log in as that account, open System Settings, go to Users & Groups, select the locked account and change its password.
Same keychain caveat applies. The account password changes; the keychain password doesn't follow it.
3. Recovery mode's password reset tool
Boot into Recovery mode. On Apple silicon that's holding the power button until "Loading startup options" appears. On Intel it's Command-R while the Mac starts.
Once there, open Terminal from the Utilities menu and run:
resetpassword That launches a graphical assistant which walks you through picking a volume, choosing a user and setting a new password.
4. Your FileVault recovery key
When FileVault was switched on, macOS either stored the recovery key in your iCloud account or showed you a 24-character code and told you to keep it. If you kept it, you can use it at the login window after enough failed attempts, or inside Recovery.
Look for it in a password manager, a printout, or a screenshot in Photos from whenever you set up the machine. People save these far more often than they remember saving them.
When the data is gone
Here's the honest version, because most articles on this topic bury it.
If FileVault is enabled, and you've no recovery key, no Apple ID reset option and no second admin account, nobody can recover the data. Not you, not Apple, not a repair shop, not recovery software. The disk contents are encrypted and the key is derived from credentials you no longer have.
Your only remaining path is to erase the drive and reinstall macOS, which gives you a working Mac and no files. If those files matter and you've any backup at all, restore from that instead.
This is worth understanding before you're locked out. FileVault is the right setting to have on, and it's protecting you here, but it means your recovery key isn't optional paperwork.
Get your Mac back in shape once you're in
Once you're logged in again, CleanMachine shows FileVault status alongside eleven other security checks, so you can confirm your recovery setup is sane before you need it. Scanning is free.
↓ Download Free & ScanAfterwards: sort out your keychain
If your saved passwords disappeared after a reset, they aren't deleted. Open Keychain Access, and you'll likely see a second login keychain. macOS keeps the old one and starts a fresh one, because it can't unlock the old one with a password it doesn't have.
If you later remember the old password, you can unlock it and copy things across. If you don't, delete the orphaned keychain to stop macOS prompting you for it every time you open a browser.