The fastest way depends on whether you remember any password at all
If you can log in to your computer but forgot the password you use to unlock it, Windows and Mac both let you reset it from the login screen in a few minutes. If you are completely locked out, the process takes longer and requires either a recovery code you saved earlier or access to another device. The steps differ between Windows and Mac, so find your operating system below and follow the exact order.
Do not restart your computer repeatedly or try random passwords — after several wrong attempts, both systems will lock you out temporarily as a security measure, making the problem worse.
Key Takeaways
- On Windows 10 or 11, click "I forgot my password" on the login screen and answer your security questions or use a recovery email to reset it in minutes.
- On Mac, restart the computer and hold Command+Q at the login screen to access password reset options, or use another Mac with your Apple ID.
- If you set up a recovery code when you created your account, save it somewhere safe now — you will need it if you are locked out completely.
- Windows and Mac both slow down login attempts after several wrong passwords, so do not guess repeatedly.
- If you cannot reset your password through the built-in tools, you may need to reinstall your operating system, which erases your files.
Resetting your password on Windows 10 or 11 from the login screen
On the Windows login screen, look for the text "I forgot my password" below the password field. Click it. Windows will ask you to verify your identity using one of the methods you set up when you created your account — usually a security question, a recovery email address, or a phone number where you can receive a code.
Answer the security question or check the email address you provided. If you chose email, Windows sends a code to that address. Open your email on another device or computer, find the message from Microsoft, and copy the code. Return to your computer and enter it in the box on the login screen. Windows then lets you type a new password. Make it at least 8 characters long and include a mix of uppercase letters, numbers, and symbols so it is harder to guess.
Once you enter the new password twice to confirm it matches, click Next. You can now log in with your new password. If you do not have access to the email address or phone number you registered, or if you cannot remember the answer to your security question, move to the section below on being completely locked out.
Resetting your password on Mac from the login screen
On a Mac login screen, you cannot click a "forgot password" link the way you can on Windows. Instead, restart your Mac. As it starts up, hold down Command+Q before the login screen appears. This opens the reset password utility. Enter your Apple ID email address and password. Mac will send a verification code to a trusted device — usually your iPhone or iPad if you have one linked to your Apple ID.
Open the message on that device, copy the code, and enter it on your Mac. You can then create a new password. If you do not have a trusted device, you can answer security questions you set up with your Apple ID instead. Once you reset your password, restart your Mac normally and log in with the new one.
If you do not remember your Apple ID password either, or if you do not have a trusted device and cannot answer your security questions, you will need to use another Mac or iPhone to reset your Apple ID password first through iCloud.com, then return to your locked Mac and try again.
What to do if you are completely locked out of Windows
If you cannot answer your security questions, do not have access to your recovery email, and cannot receive a code on your phone, Windows has one more option: a recovery code. When you first set up your account, Windows may have given you a recovery code — a long string of numbers and letters. If you saved this code somewhere safe, you can use it now.
On the login screen, click "I forgot my password" and select the option to enter a recovery code instead of answering security questions. Paste or type the code. Windows will let you set a new password. If you never saved a recovery code, or if you cannot find it, you will need to reinstall Windows. This erases all files on your computer, so it is a last resort. You can reinstall Windows using another computer and a USB drive — search Microsoft's support site for "reinstall Windows" and follow their instructions for creating installation media.
What to do if you are completely locked out of Mac
If you cannot access a trusted device and do not remember the answers to your Apple ID security questions, Mac requires you to prove you own the account through Apple Support. Go to iforgot.apple.com on another device, enter your Apple ID email, and follow the steps to verify your identity. Apple may ask for the serial number of your Mac, which you can find by looking at the original box it came in or by checking your Apple purchase receipt.
Once Apple confirms you own the account, you can reset your Apple ID password. Return to your locked Mac, restart it, and hold Command+Q to open the password reset utility again. Enter your Apple ID and your new password. If you still cannot get in, or if you do not have access to another device, you will need to erase your Mac and reinstall macOS. This removes all your files. You can do this using macOS Recovery — restart your Mac and hold Command+R as it starts, then choose "Erase Mac" and reinstall the operating system.
How to prevent being locked out in the future
The easiest way to avoid this problem is to write down your password in a physical notebook kept somewhere find — a locked drawer or safe at home. This is safer than it sounds because a notebook in your house cannot be hacked remotely. If you prefer not to write it down, use a password manager like Bitwarden or 1Password, which stores passwords encrypted on your device and in the cloud.
On Windows, open Settings, go to Accounts, and click "Security info" to add a recovery email and phone number if you have not already. On Mac, open System Settings, click your name at the top, and make sure your trusted phone number and recovery email are current. If Windows offers you a recovery code, save it in a safe place — take a photo of it and store the photo in cloud storage like OneDrive or Google Drive so you can access it from another device if you need it.
Frequently Asked Questions
How long does it take to reset my password?
If you can answer your security questions or access your recovery email, you can reset your password in 5 to 10 minutes. If you need to contact Apple Support or reinstall your operating system, it can take several hours or longer.
Will resetting my password delete my files?
No — resetting your password through the normal recovery process keeps all your files. Only if you erase and reinstall your operating system will you lose files, and that is a last resort when you cannot reset your password any other way.
Can I reset my password if I do not have another device?
On Windows, you can use a library or friend's computer to access your recovery email and get a reset code. On Mac, you will need another Apple device or access to a computer to contact Apple Support and verify your identity before you can reset your password.
What should I do if I keep forgetting my password?
Use a password manager to store it securely, or write it in a notebook kept in a locked drawer at home. You can also set Windows or Mac to log in using your fingerprint or face recognition instead of typing a password each time.
Is it safe to use the same password for everything?
No — if someone learns that password, they can access all your accounts. Use a different password for each important account, especially email and banking. A password manager makes this easier by remembering them for you.