Every Apple iPhone has the ability to use a "passcode"--a four-digit number that must be entered to bring the iPhone out of standby mode when it has been locked. If you are the first owner of the iPhone and have forgotten the passcode that you initially entered, you can simply reset the passcode by connecting the iPhone to the computer that was originally used to activate it. However, this does not help if you purchased the phone used and are not the original owner. Put your iPhone into recovery mode to restore the iPhone and clear the passcode.
Connect the iPhone to your computer using the USB cable.
Hold down the power button on the iPhone. The screen will change asking you to use a slider to power the unit off. Use the slider.
Press the power and home (bottom-centre) buttons simultaneously. The unit will power back on. After a few seconds, the screen will change to a warning triangle. The iPhone is now in recovery mode.
Launch iTunes and click on the iPhone icon on the left side of the screen. Make sure that the "Summary" tab is selected and scroll down until you see the "Restore" button. Click "Restore."
Click "Don't Back Up," then click "Restore." The iPhone will be reverted to its original factory settings, which will clear the passcode. Note that this process will also remove all other data from the iPhone, including music, contacts, notes and saved e-mails.