Forgetting your phone’s PIN, pattern or passcode is stressful, especially when your photos, messages and two-factor codes are stuck behind it. Modern iPhones and Android phones are built so that a forgotten screen lock usually can’t be removed without erasing the device, but there are official ways back in, and one or two options that might even save your data. Here’s what to try, and in what order.
These steps are only for phones you own or are authorized to manage. Keep in mind that you’ll still need your Apple Account or Google Account details after a reset.
First, figure out which lock you’re dealing with
A “locked phone” can mean several different things, and each one has its own fix:
Screen lock: the PIN, password or pattern you use to unlock an Android phone, or the passcode on an iPhone.
SIM PIN: protects the physical SIM card or eSIM profile and is separate from the screen lock.
Account lock: the Apple Account or Google Account sign-in required during setup or after a reset.
Carrier lock: restricts the phone to one mobile network, and only the carrier can officially remove it once you meet its conditions.
Work or school management: a company-owned or managed phone may be controlled by an IT administrator.
Whatever the lock, stop guessing. Repeated wrong attempts can trigger longer waiting times, a security lockout, a blocked SIM, or even an automatic wipe if that option was turned on.
What to check before you erase anything
Make sure the problem is the screen lock and not the SIM PIN. Removing the SIM won’t remove a screen passcode.
Try Face ID, Touch ID or your fingerprint if the phone still accepts them. After a restart, a timeout or several failed attempts, the main PIN or passcode is usually required.
If you changed your iPhone or iPad passcode in the last 72 hours and it runs iOS or iPadOS 17 or later, you can still use the previous passcode (more on that below).
Recover your Apple Account or Google Account password on another trusted device before resetting the phone.
Check what’s backed up. A reset permanently deletes anything stored only on the phone, including photos, messages and authenticator data. If you’re not sure where your pictures end up, our guide to where you should store photos from your phone walks through cloud, SSD and backup options.
For a work phone, contact IT first. A managed device may need an administrator-approved recovery process.
Forgotten Android PIN, password or pattern
On current Android versions, there’s no legitimate way to reveal or replace a forgotten screen lock while keeping the data stored on the phone. Google’s official advice is to erase the phone and set it up again. The old “Forgot pattern?” option only existed on Android 4.4 and earlier, so ignore guides that still recommend it.
Option 1: Erase it remotely with Google Find Hub
On another device, open Google Find Hub and sign in with the Google Account that’s on the locked phone. For remote erase to work, the phone has to be turned on, connected to mobile data or Wi-Fi, signed in to that account, and have Find Hub turned on. Select the correct phone and choose the option to factory reset it.
This deletes all apps, photos, music and other data stored on the phone. When you set it up again, Android’s device protection will ask for a Google Account that was previously synced to the phone, or the old screen lock, before you can continue.
Option 2: Factory reset with the phone’s buttons
If remote erase isn’t available, follow the manufacturer’s official support page for your exact model, because button combinations and recovery menus differ between Google Pixel, Samsung Galaxy, Motorola, Xiaomi and other brands. Only choose the factory reset or wipe data option once you’re sure you know the account details you’ll need afterward.
Avoid “FRP bypass” tools, paid unlock codes, modified firmware and videos that exploit setup screens. Factory Reset Protection is an anti-theft feature, and unofficial bypass tools are often scams that can damage the phone or install malware. Using them on someone else’s device is also illegal.
How to prepare for Factory Reset Protection
Know which Google Account was previously added and synced to the phone.
Confirm the password by signing in on another device before you reset.
If you’ve just changed your Google Account password, Google recommends waiting 24 hours before doing a factory reset.
Charge the phone to at least 70% and have Wi-Fi or mobile data ready for activation.
Keep your proof of purchase and the phone’s serial number or IMEI in case the manufacturer asks you to verify ownership.
Forgotten iPhone passcode
Try your previous passcode first
On iOS 17 or later, Apple’s Passcode Reset feature lets you use your previous passcode for up to 72 hours after changing it. After five wrong attempts, tap Forgot Passcode?, choose Enter Previous Passcode, type the old code and create a new one. Your data stays exactly where it was.
Reset directly from the lock screen
On supported versions, an iPhone that shows Security Lockout or iPhone Unavailable can offer a Forgot Passcode? or Erase iPhone option. The phone needs an internet connection, Find My must have been turned on, and you’ll need your Apple Account password. This erases the iPhone, and on iOS 17 or later you may be able to choose whether to keep or delete your eSIM.
Use recovery mode with a Mac or Windows PC
If the lock-screen reset isn’t available, connect the iPhone to a Mac or Windows PC, put it into recovery mode and select Restore in Finder or the Apple Devices app. This downloads the latest software, erases the iPhone and removes the forgotten passcode, and Apple says the process can take up to about an hour. You’ll need a reliable data cable, such as the Apple USB-C to Lightning cable for iPhone 14 and older or the Apple USB-C woven charge cable for iPhone 15 and newer. If the buttons don’t work or you can’t get into recovery mode, contact Apple or an Apple Authorized Service Provider.
Activation Lock stays on after the erase. You’ll need the Apple Account that was linked through Find My to activate the iPhone again, and a restore doesn’t skip that check.
Forgotten SIM PIN or blocked SIM
A SIM PIN isn’t the same as your phone’s screen PIN. After several wrong SIM PIN attempts, the SIM asks for a PUK (Personal Unblocking Key). Don’t guess the PUK, because too many wrong entries can permanently disable the SIM. To find it:
Check your carrier’s website or official app.
Look at the original SIM card holder if you still have it.
Contact your carrier through a verified support number, or visit an official store with ID.
If you use an eSIM, ask the carrier whether you need a new activation code or profile.
You can usually turn off the SIM PIN in your phone’s mobile or security settings, but that makes it easier for a thief to use your SIM in another phone. If theft or account takeover worries you, it’s worth keeping it on.
What if you’ve also forgotten your Apple or Google password?
For an Apple Account, use Apple’s official account recovery from a trusted device or Apple’s account recovery service, which can take a while if you don’t have access to your trusted phone number or devices. For a Google Account, use Google Account Recovery, ideally from a device, browser and location you’ve used before, and answer the recovery questions as accurately as you can.
A repair shop can’t legitimately remove Apple’s Activation Lock or Android’s Factory Reset Protection without the account or an official ownership process. Proof of purchase can help the manufacturer review your case, but it doesn’t guarantee they’ll remove the account lock.
What to do if your phone is lost or stolen
If the phone is missing rather than just locked, don’t erase it straight away unless the risk to your data outweighs the chance of getting it back. First use Apple Find My or Google Find Hub to locate it, play a sound, mark it as lost and show your contact details on the screen. Contact your carrier to suspend the SIM or eSIM and write down the IMEI. If you think it was stolen, report it to the police and don’t go to an unfamiliar location to get it back yourself.
If you’re unlikely to recover it, erase it remotely. That protects your data but may stop location tracking, depending on the phone. Then change your important passwords, sign out of unfamiliar sessions, and review access to your banking, email and authenticator apps.
How to avoid getting locked out again
Use a strong passcode you’ll remember: at least six digits or an alphanumeric password, avoiding birthdays, repeated digits and patterns that show up in screen smudges.
Keep biometrics on, but remember your code: Face ID or a fingerprint is convenient, but the main passcode is still needed after restarts and security events.
Back up automatically: turn on iCloud Backup or Google backup, and keep a second copy of irreplaceable photos and authenticator recovery codes. On Android, our simple guide to how Google Drive works shows what gets backed up and where to find it, and a portable drive like the Samsung T7 SSD is an easy way to keep an offline copy too.
Keep account recovery up to date: trusted phone numbers, recovery email addresses, passkeys and backup codes.
Turn on theft protection: Find My on iPhone, and Find Hub plus Android’s Theft Protection features, including Theft Detection Lock and Offline Device Lock where available.
Store proof of ownership: keep the receipt, serial number and IMEI somewhere other than the phone itself.
The bottom line
Today’s iPhones and Android phones are deliberately designed to resist lock-screen bypasses. If you can’t use a recent-passcode option, the official route is usually to erase the phone, prove you own the account and restore from a backup. That’s frustrating when it happens to you, but it’s also what makes a stolen phone useless to a thief, which is why up-to-date backups and account recovery details matter so much.