How to Wipe Data from Your iPad, iPhone, or iPod touch
Before you sell your old iPad, iPhone, or iPod touch to a buddy or a company like Gazelle, it's vital that you wipe the entire device of all its content; including sensitive material like contacts, messages, pictures, and videos. There are two easy ways to wipe your iOS device, so let's show you how to do it using iTunes or directly from the device itself.
Firstly, Create a Backup
Before getting started, it's important that you have a recent backup of your iOS device, which can be done using either iTunes or iCloud.
Wipe the Device Using iTunes
Start by disabling Find My iPhone (or iPad/iPod) on your device, which can be found under Settings -> iCloud -> Find My iPhone (or iPad/iPod). You will need to enter your Apple ID password to toggle the service off.
With your iOS device connected to your computer, launch iTunes, then select your device from the options along the top bar.
Next to your device's information, click the Restore iPhone (or iPad/iPod) button to begin the restoration process and revert your device to factory settings.
After selecting to restore the device, you will need to confirm once more before the process commences. Using this method will download a new copy of the latest iOS build onto your iPhone.
Wipe the Device Without iTunes
As simple as it is using iTunes, you may not be near a computer or have one readily available. To seamlessly wipe your device without a computer, go to Settings -> General -> Reset.
From within these preferences, select "Erase All Content and Settings." You will be prompted to enter your passcode, then confirm that you want to wipe your device of all its media, data, and settings.
Although the iTunes method will update the device to the latest version of iOS, both methods will erase everything on it. And while this can be used before selling your iPad, iPhone, or iPod touch, it's also a great trick for freeing up space on your iOS device.
Additionally, both methods will remove jailbreak, so there's no need to fret the fear of a voided warranty in case you're selling it back to your carrier.
Restoring the Device
If you want to restore the device you just wiped or a new one you purchased, just connect the device back into iTunes and use the iTunes backup you created, or follow this guide on restoring with an iCloud backup.