When selling your phone, what steps should be taken to make sure that all personal data has been removed? I am getting rid of my Samsung Galaxy S4 and want to know what steps I should take to make sure that private information has been deleted from the phone.  I have removed the SD card and cleared all of the gallery files as well as music.  What other steps can I take to make sure that the phone is as sterile as possible?
Remove the SD Card and SIM Card, and then do a Factory Reset.

If your device doesn't use full disk encryption, and you are worried about someone using advanced forensic tools to recover your data, you might want to overwrite the internal storage area with random data. You can do this by creating a file containing random data that fills up the entire free space. Once you've done that, do another factory reset.

If you've flashed and/or rooted your device, you would want to flash a stock ROM, and restore the default boot loader.