1. Activate DFU recovery mode on your iPhone.
2. Then, using a Lightning connector, connect it to a PC or Mac.
3. Select your iPhone from the Finder sidebar on Mac, or from iTunes on the PC to which it is attached.
4. When you see the choice to Restore or Update, select Restore.
Wait for the process to finish.
5. Disconnect your iPhone, then turn it on and set up it.