iTunes for Mac: Restore your iPod, iPhone, or iPad to factory settings
You can use iTunes to reinstall the software on your device and restore it to its default settings. You might need to do this if you’re having problems with the device (for example, if it freezes or crashes frequently) of if you’re getting ready to sell or give away your device.
Important: Restoring iOS software on iPod touch, iPhone, or iPad deletes all your information and settings. However, iTunes backs up your device before restoring it, so you can use the backup to restore your device to how it was when you last used it.
Restore your device
Connect your device to your computer.
Click the device button, then click Summary.
Click Restore, and follow the onscreen instructions.
Restoring iOS software on your iOS device deletes all your information and settings, but doesn’t erase it. Deleted information can’t be accessed through the device’s controls, but it remains on your device. To find out more about erasing all content and settings, see the Apple Support article What to do before selling or giving away your iPhone, iPad, or iPod touch.
If you’ve enabled Find My iPhone, Activation Lock is on. You need to turn off Activation Lock before the new owner can activate iPhone under his or her own account. For information about turning off Activation Lock, see iCloud Help or the Apple Support article Find My iPhone Activation Lock in iOS 7.