Here's how you can do a factory reset on your Android phone. Please note that these steps are for stock Android devices. Other devices may have slightly different settings, but they shouldn't be too hard to find. The end result is still the same, you will erase all of the data on your Android phone or tablet.
1. Go to Settings.
2. Go to Backup & Reset.
3. Tap on Factory Data Reset.
4. Tap the Reset Phone button.
Additional resources for Android