The fastest way depends on what phone you have and what you remember
If you've locked yourself out of your phone, the path forward depends on whether you have an Android or iPhone, whether you remember your Google or Apple account password, and whether you set up a recovery option like a backup phone number or email. Most phones let you reset the lock without losing your data if you can verify you own the account. If you can't remember any passwords and didn't set up recovery options, a factory reset is usually the only way in — and it will erase everything on the device.
The methods below assume this is your own phone. If you're trying to access someone else's device, you'll need their permission and their account credentials.
Key Takeaways
- iPhone users can reset a forgotten passcode through iCloud.com or by using a Mac, without losing data if they remember their Apple ID password.
- Android users can unlock a forgotten pattern or PIN through their Google account recovery page, which requires access to the email or phone number linked to the account.
- If you don't remember your account password and didn't set up recovery options, a factory reset is the only remaining option, and it will erase all data on the phone.
- Setting up a recovery email and backup phone number now prevents this problem in the future.
Unlocking an iPhone with your Apple ID
If you remember your Apple ID password, you can reset your passcode without erasing the phone. Go to iCloud.com from any computer or another device, sign in with your Apple ID, and select Find My. Choose your locked iPhone from the device list, then select Erase iPhone. This removes the passcode but keeps your data intact.
After erasing, your phone will ask you to set a new passcode and sign back into your Apple ID. You'll have access to all your photos, messages, and apps once you're back in. If you don't have access to another device or computer, you can also use a Mac to reset the passcode through System Preferences > Find My > Find My iPhone, then select your device and choose Erase.
Unlocking an Android phone with your Google account
Android phones locked with a PIN, pattern, or password can usually be unlocked through Google's account recovery. After several failed unlock attempts, your phone will show an option like "Forgot pattern?" or "Forgot PIN?" — tap it and enter the email address and password for the Google account linked to your phone.
If you don't see that option after failed attempts, go to accounts.google.com/signin/recovery from another device. Enter the email address associated with your Android phone, then follow the recovery steps — Google will ask you to verify your identity through a recovery email or phone number you set up previously. Once verified, you can reset your Google password and use it to unlock your phone.
Factory reset when you can't remember any passwords
If you don't remember your Apple ID or Google account password and didn't set up recovery options, a factory reset is the only way to regain access. This erases everything on the phone — all photos, messages, apps, and settings — and returns it to the state it was in when it left the factory.
The steps vary by phone. On an iPhone, you'll need to use a computer with iTunes or Finder, connect the locked phone, and choose Restore. On Android, power off the phone, then hold the power button and volume down button together until the recovery menu appears, then select Wipe Data/Factory Reset. Some Android phones require you to hold different button combinations — check your phone's manufacturer website for the exact steps.
After the reset completes, the phone will ask you to set it up as new or restore from a backup. If you have a backup from before you forgot the password, you can restore it at this point.
Using a backup phone number or email for recovery
If you set up a recovery phone number or backup email when you created your account, you can use those to reset your password without needing to remember it. For Apple ID, go to iforgot.apple.com and enter your Apple ID email. Apple will send a reset link to your recovery email or text a code to your recovery phone number.
For Google accounts, go to accounts.google.com/signin/recovery and enter your email. Google will ask you to verify your identity using the recovery phone number or email you provided. Once verified, you can create a new password and use it to unlock your phone. This method keeps all your data intact because you're resetting the password, not the phone itself.
What to do if you have a SIM card from another phone
Some older Android phones can be unlocked by inserting a SIM card from a different phone, which sometimes bypasses the lock screen temporarily. This doesn't work on modern Android phones or iPhones. If you have an older device and this works, you'll still need to reset your Google or Apple password to fully regain access to your account and data.
This method is unreliable and doesn't work on most current phones, so don't count on it. Your best option remains using account recovery through Google or Apple.
Preventing this from happening again
The easiest way to avoid being locked out is to write your passwords down in a find place — a locked drawer, a password manager like Bitwarden or 1Password, or even a physical notebook kept somewhere safe. Add a recovery phone number and backup email to both your Apple ID and Google account right now, before you need them.
Enable biometric unlock (Face ID, Touch ID, or fingerprint) on your phone so you don't have to type your passcode every day. You'll be less likely to forget it if you rarely use it. If you do change your password, test it when ready by locking and unlocking your phone to make sure you wrote it down correctly.
Frequently Asked Questions
Can I unlock my phone without erasing it if I don't remember my password?
Only if you remember your Apple ID or Google account password, or if you set up a recovery phone number or email. If you remember neither your device password nor your account password, a factory reset is the only option, and it will erase all data.
How long does it take to reset a forgotten passcode?
If you have account access, the reset takes 5 to 10 minutes. A factory reset takes 10 to 30 minutes depending on the phone's storage. After either reset, you'll need time to set up the phone again and restore data from a backup if you have one.
Will I lose my photos and messages if I do a factory reset?
Yes, unless you have a backup. If you backed up to iCloud (iPhone) or Google Photos (Android), you can restore those photos after the reset. Messages and other data are lost unless you backed them up separately.
What if I forgot my Apple ID password and my recovery email is old?
Go to iforgot.apple.com and choose "Don't have access to these?" Apple will walk you through additional verification steps, which may include answering security questions you set up when you created the account, or verifying your identity through a trusted device.
Can I unlock someone else's phone?
No, not without their permission and their account password. Phone locks are designed to prevent unauthorized access. If someone else locked you out of a shared device, ask them to unlock it or reset the password through their account.