Free download and install FoneEraser for iOS on your computer and then it will get launched automatically once the installation is finished.
Plug your iSO device to the computer via a USB cable. Then enter passcode on your device if it is locked and click Trust on the device for iOS 7 or higher version.
The software will soon detect your device. Here you can select erasing level (Low, Medium or High) according to your need and then click OK.
Click the Start button on the right side to begin erasing and then click Yes to confirm again. Wait for the erasing process to complete.