note: please backup your iPhone 5 before starting , since all your data will be erased.
i will explain to you how to format apple iPhone 5 , please follow the tips carefully :
first method from inside the iPhone 5 :
Go to Settings > General > Reset
then select Erase All Content and Settings see the photo below: