Erase all content and settings from iPhone
When you delete data, it’s no longer accessible through the iPhone interface, but it isn’t erased from iPhone storage. To remove all of your content and settings from storage, erase iPhone. For example, erase iPhone before you sell it or give it away. If you want to save your content and settings, back up using iCloud or iTunes before erasing iPhone.
When iPhone restarts with all content and settings erased, the setup assistant gives you the option to either set up iPhone as new or restore it from an iCloud or iTunes backup. (See Turn on and set up iPhone.)