Erasing and resetting your iPhone
You can completely erase all the information on your iPhone, and reset it to its original state. You might want to do this before you give your iPhone away or if you are having problems.
To erase your iPhone:
Connect your iPhone to your computer.
When the iPhone appears in the iTunes window, select it.
In the Summary pane, click Restore.