Before wiping the phone clean of personal information, make sure the important data you’d like to keep is backed up. See more about how to backup your data here. You’ll also need to remove your Google account from your device— learn about that here. Your Samsung reactivation lock should also be removed from your device— you can see how to do this here.
Now that your data is backed up and your Google and Samsung accounts are no longer associated with your phone, there is one last important step to prepare your phone for sale: removing your personal information.
To erase all personal data from your device, just go to Apps > Settings > Backup & Reset > Factory Data Reset and select “Reset phone”. You will be required to input your passcode.
Once this is done, your phone will show a loading screen for a while, after which, your phone will be permanently cleared of all your personal data and restored back to its factory settings.