How To Reset Your IPhone If You Forget Your Passcode
If you can't remember your passcode, you'll need to erase your iPhone, which deletes your data and settings, including the passcode. If you've never synced with iTunes or set up Find My iPhone in iCloud, you'll need to use recovery mode to restore your device. This will erase the device and its passcode.
Before you begin
If you've never synced with iTunes or set up Find My iPhone in iCloud, you'll need to use recovery mode to restore your device. This will erase the device and its passcode.
If you have a backup, you can restore it after you erase the device. If you don't have a backup, you'll need to set up your device as new.
Erase your device with iTunes
Connect your device to your computer and open iTunes. If you don't have a computer, borrow one from a friend or go to an Apple Retail Store or Apple Authorized Service Provider.
While your device is connected, force restart it:
On an iPhone X, iPhone 8, or iPhone 8 Plus: Press and hold the Side button and either volume button until the power off slider appears. Drag the slider to turn off your device. Then, press and hold the Side button again until you see the Apple logo.
On an iPhone 7 or iPhone 7 Plus: Press and hold the Side and Volume Down buttons at the same time. Keep holding them until you see the power off slider.
On an iPhone 6s and earlier, iPad, or iPod touch: Press and hold the Side (or Top) button until the power off slider appears. Drag the slider to turn off your device. Then, press and hold the Side (or Top) button again until you see the Apple logo.
When you see the option to Restore or Update, choose Restore. iTunes will download software for your device. If it takes more than 15 minutes, your device will exit recovery mode and you'll need to repeat these steps.
Wait for the process to finish.
Set up your device
Follow the onscreen setup steps until you reach the Apps & Data screen, then tap Restore from iTunes Backup > next.
Connect your device to the computer that you used to back up your device. Open iTunes. If a message asks for your device passcode or to Trust This Computer, follow the onscreen steps.
Select your iPhone, iPad, or iPod touch when it appears in iTunes. If you have an encrypted backup, you'll be prompted to enter the password.
Look at the date and size of each backup and pick the most relevant one.
Click Restore and wait for the restore time to finish. If you don't see a list of backups, it means that you have never synced with iTunes on this computer. You can learn what to do next.
After your device restores, it restarts. Now you can set up your device from your backup.