Before you return, resell, or gift your old iPhone, it's important to wipe it clean first. If you don't, the sensitive data on it -- your passwords, location history, photos, and financial info -- could fall into the wrong hands and end up costing you your identity.
First, before you wipe, ensure that you've backed up all your data.
Next, turn off Find My iPhone so that you no longer have the power to remotely disable the phone and render it useless to its new owner. (If you're trading in an old phone, the carrier often requires this step). To turn off the phone-locating feature, tap the Settings app and iCloud, toggle Find My iPhone to off, confirm your password in the pop-up, and finally tap Turn Off.
Finally, plug in your phone, tap the Settings app, General, Reset, then Erase All Content and Settings.