If you're selling your iPhone or iPad or passing it on to someone else, the first thing you'll want to do is make sure they won't have access to any of your personal data. Fortunately, iOS makes it very easy to wipe all your data off your old iPhone or iPad, no computer required. Here's how:
Before doing this, you obviously want to make sure you either have an iCloud backup or an iTunes backup of your data. Otherwise, you won't be able to get your stuff back. Once you're sure you have a backup for your own use, proceed on.
If you're on iOS 7 already and you have an iCloud account linked to your iPhone or iPad, you'll need to sign out of Find My iPhone before you can truly wipe the device.
That's it, you can now proceed to wiping your iPhone or iPad. The above steps are only necessary if the iPhone or iPad you're trying to restore is on iOS 7.0 or above.
That's it. Your iPhone or iPad will reboot after a few minutes and all your personal data should be gone and again look like the day you pulled it out of the box.