First: did you recently change it?
On iOS 17 or later, your previous passcode keeps working for 72 hours after you change it. This is the only way to get in without erasing.
- Enter wrong passcodes until the iPhone Unavailable screen appears (this happens after five wrong tries).
- Tap Forgot Passcode? in the bottom corner.
- Tap Enter Previous Passcode.
- Type your old passcode and follow the prompts to set a new one right away.
If you don't see Enter Previous Passcode, more than 72 hours have passed or you never changed it. Move on to the options below.
Option 1: Erase from the lock screen (no computer)
This works on iOS 15.2 or later, as long as the iPhone has Find My turned on, is signed in to your Apple Account, and is connected to Wi-Fi or cellular. You'll need your Apple Account password.
- Keep entering the wrong passcode until iPhone Unavailable appears.
- Tap Forgot Passcode?
- On the Security Lockout screen, tap Start iPhone Reset and confirm.
- Enter your Apple Account password to sign out of the account on this phone.
- Tap Erase iPhone. If you use an eSIM, you'll be asked whether to keep it or delete it; keep it if you want to keep using the same line.
- When the iPhone restarts, set it up again, restore from your backup, and choose a new passcode.
On iOS 15.2 and iOS 16 the button on the lock screen is called Erase iPhone instead of Forgot Passcode?, with the same requirements. If you erase an eSIM phone on iOS 16 or earlier, contact your carrier first for a QR code to set the eSIM up again.
Option 2: Erase with a Mac or PC (recovery mode)
Use this if the lock screen doesn't offer a reset, for example because the phone is offline or Find My was off. You need a Mac or Windows PC, a cable that charges your phone, an internet connection, and up to an hour.
- Turn off the iPhone. Face ID models: hold the side button and volume down until the power-off slider appears, then drag it. Home button models: hold the side or top button, then drag the slider. Unplug it from the computer if it's connected.
- Find the right button: side button on Face ID iPhones and on iPhone 8, 8 Plus and SE (2nd and 3rd generation); volume down on iPhone 7 and 7 Plus; Home button on iPhone 6s and earlier and SE (1st generation).
- Hold that button while you plug the cable into the iPhone. Keep holding through the Apple logo until the computer-and-cable screen appears.
- On a Mac, open Finder and select the iPhone under Locations. On a PC, open the Apple Devices app, select the iPhone, then General.
- Choose Restore and follow the steps. The computer downloads iOS and erases the phone.
- When the Hello screen appears, unplug and set up the phone.
If the download takes more than 15 minutes, the phone may leave the recovery screen. Let the download finish, turn the iPhone off, and do steps 2 and 3 again.
Getting your data back
Erasing deletes everything on the phone. What you get back depends on your backup:
- iCloud backup: during setup, choose Restore from iCloud Backup and sign in. Pick the most recent backup by its date.
- Computer backup: connect to the Mac or PC you backed up to and restore from there.
- No backup: anything synced to iCloud (Photos, Contacts, Notes, if those were on) comes back when you sign in. Anything stored only on the phone can't be recovered.
- WhatsApp and WeChat: chats return only if the app had its own backup; restore from inside each app after you reinstall it.
If it doesn't work
- No Forgot Passcode? button: the iPhone isn't online, Find My is off, or it's on iOS 15.1 or earlier. Connect it to Wi-Fi or cellular if you can, or use a computer.
- You don't remember your Apple Account password: reset it with Apple's account recovery from another device or a browser before you erase, because you'll need it to get past Activation Lock afterward.
- Activation Lock appears after the restore: enter the Apple Account and password that were on the phone. If you bought the phone used, the previous owner must remove it from their account; with proof of purchase, you can also start an Activation Lock support request with Apple.
- The computer doesn't see the iPhone: try another cable or USB port, update macOS or the Apple Devices app, and repeat the recovery steps.
- A button doesn't work, or you have no computer: go to an Apple Store or Apple Authorized Service Provider.
Good to know
- No method recovers a forgotten passcode itself, and the data can't be kept without it. That's what keeps a stolen iPhone useless to a thief.
- To avoid this next time, turn on iCloud Backup and store your passcode somewhere safe, such as with a trusted family member.
- If the phone belongs to an older relative, help them check now that iCloud Backup is on and that they know their Apple Account password. Their phone can be in any language; the steps don't change.
People also ask
Can I unlock my iPhone without losing data if I forgot the passcode?
Only if you changed the passcode within the last 72 hours and use Enter Previous Passcode. Otherwise the iPhone must be erased, and you restore from a backup.
How many wrong passcode attempts before iPhone is disabled?
After five wrong attempts the iPhone Unavailable screen appears. That's where you'll find the Forgot Passcode? option.
Can I reset my iPhone passcode without a computer?
Yes, on iOS 15.2 or later if Find My is on and the phone is online. Tap Forgot Passcode? and then Start iPhone Reset, and enter your Apple Account password.
Can Apple unlock my iPhone if I forgot the passcode?
Apple can help you erase and restore it at an Apple Store, but it can't recover the passcode or the data that wasn't backed up.
Will I lose my photos if I reset my passcode?
Photos on the phone are erased, but if iCloud Photos was on or you have a backup, they come back when you sign in or restore.
What if I don't remember my Apple Account password either?
Reset it first through Apple's account recovery on another device or the web. You'll need it to sign out during the reset and to get past Activation Lock.
Facts checked against the makers' official pages on Dec 1, 2026. Sources we checked: