Perform a soft, factory, and alternate master reset of the device.
INSTRUCTIONS & INFO
This feature resets all settings to their defaults and erases all data stored on iPhone, including your Contacts, Messages, and Music. iPhone cannot be used while data is being erased. iPhone 3GS and later will instantly and securely erase all data, and then restore settings to their factory defaults. After iPhone reboots, it will display the "Connect to iTunes" screen. If you have backed up your device to iTunes or iCloud, you may be able to restore personal data back to iPhone if desired. Note: Wi-Fi or a wireless data connection is required to re-activate iPhone after a reset. Learn more from Apple support articles: Back up your iPhone and Erase all content and settings on your iPhone
From the home screen, tap Settings.
Tap General.
Tap Reset.
Tap Erase All Content and Settings. Note: You will be prompted to enter the device password if one has been created. Tap 'Reset all settings' to restore all factory options, but keep your accounts, apps, and media.
To confirm reset, tap Erase iPhone.
After a second prompt, confirm by tapping Erase iPhone.
Use this method only if unable to power on or off, or if the device is frozen. Press and hold the Sleep/Wake button and the Home button at the same time for at least ten seconds, until the Apple logo appears.