How to Fix an iPhone Passcode Lockby Lawrence Nyveen ; Updated September 28, 2017
Items you will need
The iPhone, the iPod touch and the iPad allow the user to set a numeric password of four digits, sometimes called a pass code, or even a more complicated password. If you forget your password, it's trivial to get into the device when you hook it up to the computer you last synced it with; you can then restore it, but you will lose any data entered since your last sync.
Hook up the iPhone to your computer with its USB cable. If iTunes does not open automatically, open it manually.
Click on the iPhone icon in the left column of iTunes. If iTunes does not recognize the iPhone, you will need to prime it manually. Press the iPhone's power button and move the slider to turn it off. Press the power button to turn it on. When the Apple logo appears, press and hold both the power button and the home button until a yellow "hazard" triangle appears. This puts the iPhone in restore mode and iTunes should recognize it. If not, unplug the USB cable and plug it back in.
Click on the "Summary" tab, then click on the "Restore" button. The first dialogue box to pop up will ask you if you want to back up your settings. Click the "Back Up" button to do so. A second dialogue box will ask you to confirm that you want to restore the iPhone. Click "Restore" to confirm.
Click "OK" in the box that pops up when the process has finished. The iPhone should display a "Connect to iTunes" screen. Keep it plugged in. You should eventually see the "Connect to iTunes" screen disappear or see the "iPhone is activated" screen. At this point, iTunes will display the "Set Up Your iPhone" panel.
Choose which back up you wish to restore from and click "Continue" to proceed. The back up will not restore your old password, but you may always establish a new one.