
It happens to the best of us: you change your iPhone passcode, get distracted, and twenty minutes later the new digits are gone from your memory. After a few wrong guesses the iPhone locks you out — first for a minute, then longer, and eventually it disables itself entirely. There is no "forgot passcode" button on the lock screen, but there is an official way back in: erase the iPhone through recovery mode and restore it. Here is how, with the warnings you must read first.
Read this before you start
Erasing an iPhone deletes everything on it — photos, messages, apps, settings. If you have a recent iCloud or computer backup, you can restore it afterward and lose almost nothing. If you do not, the data is gone for good, so check for a backup before you begin. And one critical point people misunderstand: erasing does not remove Activation Lock. After the restore, the iPhone will still ask for the Apple ID and password of its owner. This process cannot turn a lost or stolen iPhone into a usable one — it only helps the rightful owner who forgot their own passcode. Apple Support documents this requirement in detail.
1. Put the iPhone into recovery mode
The button combination depends on your model. Do these steps while the iPhone is NOT yet connected to the computer.
- iPhone 8 or later (including iPhone X and all Face ID models): press and quickly release Volume Up, press and quickly release Volume Down, then press and hold the Side button until the recovery-mode screen (computer icon and cable) appears.
- iPhone 7 and 7 Plus: press and hold the Side button and the Volume Down button together until the recovery-mode screen appears.
- iPhone 6s and earlier: press and hold the Home button and the Side (or Top) button together until the recovery-mode screen appears.
If the Apple logo appears first, keep holding — release only when you see the recovery screen.
2. Connect to a computer and open the right app
- Plug the iPhone into a Mac or PC with a cable. If the phone stops charging from the computer or is not recognized, try a different cable or USB port first.
- On a Mac with macOS Catalina or later, open Finder and select the iPhone in the sidebar. On an older Mac or a Windows PC, open iTunes (or the Apple Devices app on Windows 10/11).
- A dialog will say the iPhone is in recovery mode and offer Update or Restore.
3. Choose Restore and wait
- Click Restore. (Update tries to reinstall iOS without erasing, but it cannot remove a forgotten passcode — you need Restore.)
- The computer downloads the latest iOS and wipes the iPhone. This takes 15–30 minutes; if the iPhone exits recovery mode during a long download, repeat step 1 to put it back.
- When it finishes, the iPhone restarts to the Hello setup screen — the passcode is gone.
4. Set the iPhone up again
- Sign in with the owner's Apple ID to clear Activation Lock.
- When offered, choose Restore from iCloud Backup or Restore from Mac/PC to bring your data back, or set it up as new.
- Create a new passcode — and this time, write it down somewhere safe or store it in a password manager.
If it still doesn't work
If the computer never detects the iPhone, try DFU mode (a deeper restore state — MacRumors has model-specific guides), a different computer, or an Apple Store, where staff can run the restore for you with proof of purchase. If you cannot remember the Apple ID either, use Apple's account recovery — nobody, including Apple Store staff, can bypass Activation Lock without it.
Frequently asked questions
Will I lose my photos if I erase the iPhone?
Anything not backed up will be lost. Check iCloud.com or your computer for a backup first. For the future, our guide on how to permanently delete text messages from iPhone and iCloud explains how iCloud sync and backups interact, which helps you understand what is recoverable.
Can someone use this method to unlock a stolen iPhone?
No. Activation Lock survives a full erase, so a wiped iPhone still demands the original owner's Apple ID before it can be set up. That is by design, and it is why you should never buy a second-hand iPhone that is still signed into someone else's account.
Conclusion
A forgotten passcode is fixable but never painless: recovery mode plus Restore wipes the slate clean, your backup brings your life back, and Activation Lock makes sure the phone stays yours. Back up regularly, and you will never fear the lock screen again.
