This is the basic instruction for resetting all Android devices to factory settings. The reset process is very similar in recent versions of Android.
Android device software varies slightly between manufacturers, but in the latest stock Android, open up Settings then choose System:
and Reset options:
Pick Erase all data (factory reset) to complete the job:
—you get a warning screen and a list of all the accounts you have set up on your phone, then you tap Delete all data.
Then your gadget will reboot and the process of returning to factory settings will begin.