Actually there is 2 options :
1- Easy way – go setting – General –reset – Erase all content and setting ( if there is pass code enter it )
*note if you have data on iPhone, record video until you storage is full, and rested again. in this way hackers or data rumors will find bad day to retrieve your data
2- Other way , connected your iPhone to computer /windows or mac no issue , but before connecting press home bottom until recovery massage will come asking you by image to connect your iPhone to computer , and click update , I recommend this way when u want to sell your mobile
Finally – best wishes to all
mohammad zeitoun