Use iTunes to restore your iPhone, iPad, or iPod to factory settings - Apple Support
When you restore your iOS device or iPod to factory settings, you'll also install the latest version of software. You can then set up your device as new, or restore from a backup....