How to Use My iPhone If I Forgot My Passcode
The iPhone's passcode is the number you enter to proceed from the lock screen to the home screen. This four-digit code protects your iPhone's data from unwanted access, especially in the event your iPhone is lost or stolen. Sometimes, you may forget your passcode. In this case, you will need to restore your iPhone to factory settings. You can then re-sync all your data from a previous backup, so you can set your iPhone back to normal immediately.
Connect your iPhone to your computer as you would when you want to sync it.
Click your iPhone's name under "Devices" on the left side of iTunes. Click "Summary" at the top of the center screen.
Click "Check for Updates." If there is a new version of the iPhone software available, choose to download it in the dialog box.
Click "Restore" when the software update is downloaded. Follow the onscreen instructions.
Choose to restore your content from a backup if you want to return your iPhone back to the way it was immediately. You can also choose to set it up as a new phone if you want to reconfigure it yourself.
Keep your iPhone plugged into your computer until it is no longer syncing and iTunes reads "OK to Disconnect."
Reset your passcode under "Settings," and then "General," and then "Passcode Lock." Write down your new passcode and keep it in a safe place.