There comes a period of time in every beloved gadget's life—some more prolonged than others—when you need to think about replacing the electronic device that's given you so much loyal service, whether it's a smartphone, a laptop, a digital camera, or anything in between.

Aside from the fun of choosing a replacement piece of hardware, you've got two main considerations to think about when it comes to disposing of your outdated gadgets carefully: security, and the impact on the environment. You don't want your personal and private data accessible after the gadget has left your possession. And you want to get rid of the device in a way that's as kind to the planet as possible.

Here we'll show you how to take care of both considerations, no matter what the gadget you need to dispose of.

Wipe Your Data

David Nield

Whether you're sending your device to be recycled or sticking it on Ebay, you don't want your finance spreadsheets, family photos, or Twitter login to stick around on the hardware, even if you don't think anyone would go to the trouble of trying to extract the data from your old gadgets.

When it comes to gadgets with on-board storage, we're primarily talking phones, tablets, and computers. The easiest way to wipe these devices—and all the data and applications on them is to do a full reset of the operating system. But first, make sure to back up all your precious documents, pictures, and so on to a hard drive or the cloud.

For Android devices, open up the Settings app then tap System > Advanced > Reset options, and then Erase all data (factory reset). Over on iOS, the equivalent option is in the Settings app under General > Reset > Erase All Content and Settings.

If you're using a Windows computer, you need to load up the Settings app then click Update & Security, then Recovery, then Get started under the Reset this PC option. Choose to remove all personal files during the process. If you're using a Chromebook or Chrome OS tablet, open up the Settings pane and pick Advanced, then Powerwash to get your computer into an as-new state.

It's slightly more involved on a Mac: You need to restart macOS, then as soon as it begins to boot up again, hold Option+Command+R until you see a spinning globe. Release the keys, then choose Reinstall macOS, then choose Continue. Follow the on-screen instructions and select your main hard drive when prompted.