Forgot Your Phone Passcode, What to Do Next

“I typed every password I can think of and my phone still will not open.” If that is where you are, the first thing to know is that your lock screen code is not the same as your Apple Account or Google Account password, and nobody can look it up for you, not even Apple, Google, or your carrier.

What is happening

Your phone asks for a passcode, PIN, or pattern, and every password you try is rejected. After several wrong tries the phone makes you wait, and after enough wrong tries an iPhone shows “iPhone Unavailable” or “Security Lockout”, while an Android phone locks you out for a set time. This is not a glitch. The lock screen code is the key that encrypts everything on the phone, and the phone is designed to keep everyone out, including you, until the right code is entered or the phone is erased.

Why it happens

The lock screen passcode, PIN, or pattern is separate from your Apple Account password and your Google Account password. Typing an account password on the lock screen will never work. If you changed the passcode recently, muscle memory may still be typing the old one. A phone that was set up by someone else, or a secondhand phone, may have a passcode you were never told. On iPhone, iOS 17 and later keep your previous passcode working for 72 hours after a change, which can save you if the change was recent. On Android, some phones show a “Forgot pattern” or “Forgot PIN” option after several failed tries, but most current phones do not.

The fixes, in order

  1. Stop guessing and try the previous passcode. On iPhone, if you changed the passcode in the last 72 hours, keep entering codes until “iPhone Unavailable” appears, tap “Forgot Passcode?”, then tap “Enter Previous Passcode” and type the old one. This is the only route that keeps your data.
  2. Make sure you are typing the right kind of code. The lock screen wants the 4 or 6 digit passcode, PIN, or pattern you set on the phone, not your Apple Account or Google Account password.
  3. iPhone, erase from the lock screen. If you know your Apple Account password and Find My was turned on before you were locked out, keep entering codes until “iPhone Unavailable” appears, tap “Forgot Passcode?” (on iOS 15.2 and 16 the button says “Erase iPhone”), then follow the prompts and enter your Apple Account password. The phone erases itself and you set it up again. If you use an eSIM, you will be asked whether to keep it, choose to keep it.
  4. iPhone, restore with a computer. If “Forgot Passcode?” never appears or the phone has no connection, connect the iPhone to a Mac or Windows PC with a cable, put it into recovery mode (turn it off, then plug it in while holding the side button until the computer and cable image appears), and choose Restore. This erases the phone and reinstalls iOS.
  5. Android, erase remotely. If the phone is online and Find Hub is turned on, go to google.com/android/find on another device, sign in with the Google Account on the phone, select the phone, and choose Factory reset.
  6. Android, factory reset from recovery mode. If the phone is offline, turn it off, then hold the power and volume buttons to open recovery mode (the exact buttons vary by maker, check the maker’s support page for your model), use the volume buttons to choose “Wipe data/factory reset”, and confirm with the power button.
  7. After any erase, sign in with the same account. An erased iPhone asks for the Apple Account password that was on it (Activation Lock), and an erased Android asks for the Google Account that was on it (Factory Reset Protection). You need those passwords to finish setup. Then restore from your backup.
Erasing deletes everything that is not backed up or synced. Photos, messages, and files that only lived on the phone are gone after an erase. Do not trust apps, websites, or shops that claim to unlock a phone without erasing it. There is no supported way to bypass a forgotten passcode and keep the data, and those offers are usually scams or malware.

If nothing works

If you do not remember the Apple Account or Google Account password either, recover that account first on another device, through the account recovery page, because you will need it after the erase. If the phone is secondhand and still tied to the previous owner’s account, only the previous owner can remove it. An Apple Store or your carrier can walk you through the same erase steps, but they cannot bypass the lock screen for you.

Common questions

Can Apple or my carrier unlock my phone without erasing it? No. Apple, Google, Samsung, and your carrier all use the same rule: a forgotten lock screen code can only be cleared by erasing the phone. Anyone who says otherwise is selling a scam.

I changed my passcode yesterday and now the new one does not work, what do I do? On iPhone, use the old passcode within 72 hours of the change. On the “iPhone Unavailable” screen, tap “Forgot Passcode?”, then “Enter Previous Passcode”. After you get in, set a new passcode right away.

I forgot my phone password and I need my photos, what do I do? If the photos were backed up to iCloud or Google Photos, they will come back after the erase when you sign in and restore. If they only lived on the phone and there is no backup, they cannot be recovered. Check iCloud or Google Photos on another device before you erase.

Will erasing my phone delete my eSIM? On iPhone, the erase screen asks whether to keep the eSIM. Choose to keep it. On Android, a factory reset usually keeps the eSIM, but if the phone asks, keep it, and never delete an eSIM to fix a lockout, because a deleted eSIM needs a new one from your carrier.

Related guides

Forgot Apple ID Password · Forgot Wi-Fi Password · iPhone Software Update Failed

Was this helpful?