Before we begin, we need to get your device ready, so please make sure that you have done the following things: 1) Check to see if you have the latest version of iTunes installed on your Mac or PC. If you have no access to a computer, and your device is working just fine, you can erase your iPhone without a computer. 2) On your device, go to Settings >> iCloud >> Find My iPhone. Then type in your password to turn off Find My iPhone. If you forgot your password, you can refer to this post here.
3) If you want to save the information on your iPhone, iPad, or iPod touch, you can follow the post here to make a backup. Restore your device to factory settings 1) Connect your iPhone to the computer you synced with. Make sure that your iPhone is unlocked. 2) Open iTunes. Make sure that you have the latest version of iTunes. If you don’t have a computer, you can erase and restore your device without a computer. 3) If prompted to enter the password or to Trust the computer, follow the onscreen instruction to continue. If you forgot your password, please refer to this post for help. 4) You will see the little phone icon on the left side of the iTunes pane. Click this icon. If you don’t see the icon, please refer to this post here to fix it.
5) In the Summary panel, click Restore iPhone... option.
6) Click Restore again to confirm. Then iTunes will erase your device and install the latest iOS for your device.
7) When your device restores to factory settings, it restarts. You can set it up as new now.