A forgotten iPhone passcode cannot be skipped or revealed. Apple’s way back in is to erase the iPhone, set it up again, and then restore your photos, messages and apps from a backup. On iOS 17 and later (including iOS 27, the current version), the quickest route is the Forgot Passcode? button on the Lock Screen, which erases the phone without a computer. If that button never appears, you can restore the iPhone from recovery mode with a Mac or Windows PC.
Before you erase anything, check one shortcut: if you changed your passcode within the last 72 hours, you may be able to unlock the phone with the old one and keep all your data. Each option is covered below, from least to most disruptive, with notes for iOS 15.2 and iOS 16 where the screens are different.
If your iPhone still unlocks and you simply want a clean slate, you do not need any of this. Use the factory reset from the Settings app instead, which is quicker and asks for the passcode you already know.
What you need before you start
- Your Apple Account email and password. Your Apple Account (formerly called Apple ID) is the account you use for iCloud and the App Store. You need its password to erase from the Lock Screen, and again during setup if Find My was turned on. Erasing the phone without this password leaves you with a blank iPhone that still will not activate.
- A network connection on the iPhone (Wi-Fi or cellular) for the Lock Screen method.
- A backup, if you want your data back. Erasing removes everything stored on the phone. Anything saved in an iCloud backup or a computer backup can be restored afterward. Anything that was not backed up cannot be recovered.
- For the computer method: a Mac or Windows PC, a cable that can charge your iPhone, an internet connection, and up to an hour.
A few terms used below. Find My is the Apple feature that locates your devices; when it is on, it also turns on Activation Lock, which links the iPhone to your Apple Account so nobody else can set it up after an erase. Recovery mode is a special startup state that lets a computer reinstall iOS on the phone even when you cannot unlock it.
First, try your previous passcode (iOS 17 and later)
Passcode Reset gives you 72 hours after a passcode change during which the old passcode still works. Your data stays where it is. This only helps if the passcode you forgot is a new one.
- Enter the wrong passcode until the iPhone Unavailable screen appears (it appears after several incorrect attempts in a row).
- Tap Forgot Passcode? in the bottom corner of the screen.
- Tap Enter Previous Passcode.
- Type your old passcode, then follow the prompts to create a new one. The iPhone asks you to change it right away.
The Forgot Passcode? button only shows when the iPhone is locked out, connected to Wi-Fi or cellular, signed in to your Apple Account, and has Find My turned on. If you do not remember the previous passcode either, or it has been more than 72 hours, continue with the erase below.
Erase the iPhone from the Lock Screen (no computer)
This is Apple’s recommended next step on iOS 15.2 and later. It needs Find My to have been turned on before you were locked out, a working network connection, and your Apple Account password.
Warning: Step 5 permanently deletes everything on the iPhone. Only continue if you have a backup or accept that unsaved data will be lost.
On iOS 17 through iOS 27
- On the Lock Screen, keep entering a passcode until the iPhone Unavailable screen appears.
- Tap Forgot Passcode? when it appears.

- On the Security Lockout screen, tap Start iPhone Reset.
- Enter your Apple Account password. This signs your account out of the iPhone.
- Tap Erase iPhone. If you use an eSIM (a digital SIM with no physical card), you can choose to keep the eSIM and erase your data, or delete the eSIM and erase your data. Keeping it saves you a call to your carrier if you plan to keep using the same phone.

- Wait while the iPhone erases and restarts. When the setup screens appear, follow them, restore from a backup if you have one, and set a new passcode you will remember.
On iOS 15.2 and iOS 16
Older versions do not have the Forgot Passcode? button. Instead, an Erase iPhone option appears on the lockout screen under the same conditions (network connection, signed in to your Apple Account, Find My on). Tap it, confirm, and enter your Apple Account password when asked. If you use an eSIM on iOS 16 or earlier, contact your carrier before you erase and ask for a QR code to set the eSIM up again, because these versions do not offer the keep-eSIM choice.
If you see neither button, the phone is probably offline, Find My was off, or it runs a version older than iOS 15.2. Use the computer method next.
Restore the iPhone with a Mac or Windows PC
Recovery mode works even when the iPhone is offline, Find My was turned off, or the Lock Screen offers no reset option. It erases the phone and installs a fresh copy of iOS. On a Mac, you use Finder. On Windows, you use the free Apple Devices app from the Microsoft Store. (A Mac running macOS 10.14 or earlier, or a Windows PC without Apple Devices, uses iTunes instead.) For more detail on this special startup state, see the walkthrough on putting an iPhone into recovery mode.
Step 1: Turn off the iPhone
- iPhone with Face ID: press and hold the side button and the Volume down button together until the power off slider appears, then drag the slider.
- iPhone with a Home button: press and hold the side (or top) button until the slider appears, then drag it.
Step 2: Enter recovery mode
Plug the cable into the computer first. Then, as you plug the other end into the iPhone, quickly press and hold the button listed for your model. Keep holding it while the Apple logo appears, and let go only when you see an image of a computer and a cable.
- iPhone with Face ID, iPhone 8, iPhone 8 Plus, iPhone SE (2nd and 3rd generation): the side button.
- iPhone 7 and iPhone 7 Plus: the Volume down button.
- iPhone 6s and earlier, iPhone SE (1st generation): the Home button.
- iPhone Duo: Apple has a separate page for this model. Unplug it, turn it off by holding a volume button and the side button, wait a minute, then connect it and hold the side button. See Apple’s iPhone Duo reset instructions.
If the passcode screen appears instead of the computer-and-cable image, the phone started normally. Turn it off and go through this step again, holding the button until the recovery image shows.

Step 3: Choose Restore on the computer
Warning: Restore erases everything on the iPhone.
- Mac: open a Finder window and select the iPhone in the sidebar under Locations. Allow the accessory to connect if asked. When you are offered Restore or Update, choose Restore.

- Windows: open Apple Devices and select the iPhone in the sidebar. Select Trust if asked, then select General, then Restore, and follow the prompts.
- Wait. The computer downloads iOS before restoring, which can take more than 15 minutes. If the iPhone leaves the recovery screen while the download is still running, let the download finish, turn the phone off, and enter recovery mode again.
Step 4: Set up the iPhone
When the restore finishes, the iPhone shows the Hello screen. Disconnect it from the computer and go through setup. Sign in with your Apple Account when asked and choose a backup to restore if you have one.
Apple lays out the whole process, with model pickers, on its page about using a computer to reset your iPhone and passcode.
Erase it remotely from another device
If the locked iPhone is out of reach, or you would rather start the wipe from a laptop, you can erase it through Find Devices on iCloud.com. This only works if Find My was on.
- On any computer or tablet, go to icloud.com/find and sign in with the Apple Account on the locked iPhone.
- Select the iPhone in the device list.
- Select Erase This Device and follow the prompts.
If the iPhone is online, the erase starts right away. If it is offline, the erase begins the next time it connects. Activation Lock stays on afterward, so you still need your Apple Account password during setup. Apple explains the details on its erase a device in Find Devices page.
Which method should you use?
- Changed the passcode in the last three days? Try the previous passcode first. Nothing is erased.
- Phone online, Find My on, and you know your Apple Account password? Use the Lock Screen erase. No cables or computer needed.
- No reset button, phone offline, or the Lock Screen erase fails? Use recovery mode with a computer.
- No computer to borrow? Visit an Apple Store or an Apple Authorized Service Provider, which can do the restore for you.
When the reset does not go as planned
The iPhone asks for an Apple Account after the erase
That is Activation Lock, and no erase method removes it. Enter the Apple Account email and password that were on the phone. If you have forgotten the password, reset it at iforgot.apple.com, from another Apple device you are signed in to, or with the Reset Password tool in the Apple Support app on a friend’s iPhone (choose Help Someone Else). If you cannot reset it and have no trusted device, Apple’s account recovery process can take several days. The steps are in Apple’s guide to resetting your Apple Account password, and you can also follow these steps for recovering a forgotten Apple ID password.
If you own the phone but cannot get back into the account, and you have proof of purchase, you can start an Activation Lock support request with Apple. Apple describes this, along with removing the lock from the web, on its how to remove Activation Lock page.
The phone belongs to an employer or school
A managed iPhone can be tied to the organization rather than to you. Contact the IT department before erasing, because they may need to release the device or provide the account details.
The computer does not see the iPhone or the restore fails
- Install the latest updates on your Mac, or update Apple Devices on Windows.
- Use the cable that came with the iPhone or another Apple-certified cable.
- Plug directly into the computer, not a hub or keyboard port, and try a different port.
- Try a different computer if errors keep appearing.
Apple keeps a list of fixes for specific error numbers on its iOS update and restore errors page. If the buttons do not respond and you cannot reach the recovery screen at all, the iPhone may need service.
Be careful with “unlock” software
Search results are full of paid programs that promise to remove a passcode. None of them can keep your data, because the passcode protects encrypted storage. Many simply run the same kind of restore Apple’s free tools already do, and they still leave Activation Lock in place. Installing unfamiliar software and handing it access to your phone and account is also a security risk. Apple’s own methods above are free and cover every situation a legitimate owner runs into.
How to tell it worked, and getting your data back
A successful erase ends on the Hello screen with a fresh copy of iOS. Once you finish setup with your Apple Account and create a new passcode, the phone is yours again. During setup, choose to restore from an iCloud backup or from your Mac or PC; if you need help with that part, here is how to restore an iPhone from an iCloud backup.
The erase itself cannot be undone. If no backup exists, the iPhone starts out empty, though data you kept in iCloud (for example, Photos, Contacts or Notes with iCloud syncing turned on) is stored with your account rather than on the phone, and should appear again after you sign in.
Questions people ask about forgotten iPhone passcodes
Can Apple unlock my iPhone without erasing it?
Apple does not offer a way to remove a forgotten passcode and keep the data. Its documented options all erase the iPhone, and an Apple Store or Apple Authorized Service Provider is the place to go when you cannot do the computer restore yourself. The one exception is the 72-hour previous passcode option on iOS 17 and later.
Will the iPhone erase itself if I keep guessing?
Only if Erase Data was turned on earlier. That setting, found in Settings under Face ID & Passcode (or Touch ID & Passcode), wipes the iPhone after 10 failed attempts in a row. If Erase Data was off, wrong guesses lock you out but do not wipe the phone by themselves.
Do I need a backup before I start?
You cannot make a new backup while the phone is locked. Whatever iCloud or your computer saved before the lockout is what you can restore. When setup asks how to transfer your data, choose your iCloud backup or your computer backup and pick the most recent one. Both the Forgot Passcode? button and a recovery mode restore with a computer erase the phone completely, so start from whichever you can reach.
How long does each method take?
Apple says to allow up to 60 minutes for the computer method, and the iOS download alone can take more than 15 minutes. Apple does not give a time for the Lock Screen erase, but because it skips the computer download it is usually the quicker of the two. Setup and restoring a backup take extra time either way.
I bought a used iPhone and it is asking for someone else’s account. What now?
Erasing will not help, because Activation Lock belongs to the previous owner. Ask the seller to enter their password, or to remove the iPhone from their account at icloud.com/find, before you go any further.
Once you are back in, turn on iCloud Backup so a future lockout costs you nothing more than time. The quickest way to do that is to back up your iPhone to iCloud before you put it away.
You must be logged in to post a comment.