Depending if you have access to the phone or not, or what version of android you are running. You can either go to the Settings > backup & reset > Reset Phone, or you can switch off the device and hold down volume + home button and then power button for 8-10 seconds. Factory mode will pop up and you have to select (using the volume buttons to scroll and power button to select) wipe data/factory reset and select Yes!
Let me know what device you are using and what version of android if you know.
Good luck