Hi! Welcome to the samsung members community!
Log out of your Google accounts first- as even a factory reset will keep this as a security measure.
Factory reset
Plug into pc/laptop
1. Turn off the phone.
2. Press and hold Volume up, Power, and Menu simultaneously until the phone vibrates and the Samsung logo appears.
3. Use the Volume keys to navigate to Wipe data/Factory reset.
4. Press Power to select the option.
5. Select Delete all user data.
6. Tap Yes to continue.
7. When the process is complete, tap Reboot system now