Don't sell your data with your phone
Before you go selling your mobile device, you must understand you're also selling your data along with it. This could include personal information such as your name, contacts, and personal messages. It could also include more sensitive information such as passwords and account details. Learning how to safely wipe your device is important for keeping your data safe and secure.
Many people think that doing a factory reset is all they have to do when resetting their phone -- however they are wrong. When you wipe your device, a lot of information still exists in the flash memory, something a factory reset isn't going to touch. The first step you should take in wiping your device is to actually make a backup. Research online for your phone's providers and there's likely a backup tool created for your phone already if you are unsure how to do it manually.
The next step is to remove your SIM card and log out of all accounts. This includes email, social media (facebook, twitter, linkedin, etc), banking, and most importantly your google/apple account. Many people forget to do this because it is associated with your phone. Next, you should clear all your browsing data/cache as well as your app's local content.
Next is to encrypt your data. WARNING, if you interrupt the encryption you will lose your data. Make a backup and plug your phone into a charger!
For android users, follow these steps :
For iOS users your devices are encrypted by default.
For every other device, research online how to encrypt your device before going to the last step.
Finally, your last step is going to be doing a factory reset with the encryption enabled. Once that is done, your device is ready to be given away. It should be noted that while these methods will keep your device very secure, you should always know that the only full-proof way to wipe your device is to physically destroy it. If you have very sensitive information you may want to think twice before selling your device to a stranger.