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.
Now that your data is backed up and your Google account is 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 > General management > Reset > Factory Data Reset and select “Reset device”. 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.