Check Forgot passcode for your iPhone, iPad, or iPod touch, or your device is disabled from Apple for how to reset the passcode.
As all methods will erase your iPhone, the "Recovery mode" method may be the most easier and reliable one (for me).
- Disconnect all cables from your device.
- Hold down the Sleep/Wake button, then "slide to power off" to turn off your device.
- Press and hold the Home button and plug the device into your computer. If your device doesn't turn on automatically, turn it on.
Don't release the Home button.
- Continue holding the Home button until you see the Connect to iTunes screen.
- If iTunes doesn't open automatically, open it. iTunes will alert you that it has detected a device in recovery mode.
- Click OK. Then restore the device.