Electronic waste is sorted and prepared for further processing reusing. RYosha | iStock | Getty Images

Your old phones, tablets and computers don't have to sit around collecting dust in a drawer or a closet. You have a lot of options for getting rid of them and reclaiming that lost space. For gadgets that aren't too old — maybe you bought them within the last couple of years — there's probably trade-in value. Here are some tips for removing your digital clutter:

How to wipe your phone of personal information first

iPhone Xs Todd Haselton | CNBC

Before you trade, sell, recycle or donate a phone or tablet, you should first wipe it of your personal information. I'll show you how to do this on an Android phone or iPhone (and iPad), but you'll want to check the user guide for gadgets like cameras (usually just pop out the storage card) and laptops. The website iMore has a good guide for resetting a Mac, and Laptop Mag has recommendations for resetting a Windows 10 computer. Here's how to reset an iPhone: Open Settings.

Tap your name at the top of the screen.

Tap iCloud.

Choose Find my iPhone.

Turn off Find my iPhone.

Go back to the main Settings page.

Tap General.

Tap Reset.

Select Erase All Content and Settings. Here's how to reset an Android phone: Open Settings.

Tap System.

Choose Advanced.

Select Reset Options.

Choose Erase all data (factory reset.)

Trade them in for something new

Businessman with an old and a new phone. ajr_images | iStock | Getty Images

If you need a new phone or a new tablet, you can often get credit by trading in an older one. When I was buying a MacBook Air a couple of months ago, for example, I traded in my iPad Pro 10.5 to cut about $375 off the price. While the model I had still sells for more than $600 new, it was the most convenient option for me and I wasn't using the iPad as much as I expected. I took the iPad out of my bag and handed it to someone at Apple. I then walked out with a MacBook Air at a discount. Apple recently increased the value it's wiling to offer on trade-ins toward its new iPhone XR and iPhone XS phones. An old iPhone 6 knocks $150 off the price of an iPhone XS. That's not bad if your iPhone 6 is just collecting dust, or you want to replace it for a newer model. However, you might not get a lot (or anything) if it's badly damaged. You can also send old products to Amazon for store credit by using its trade-in site, or to places like Best Buy and Gazelle. These days, most phone makers and cell carriers offer deals if you're willing to trade in an old product, so just ask. Be sure to shop around and see which place is willing to give you the most money. If you aren't offered what you think a product is worth, you can make more by selling it outright.

Sell them on Swappa

30 ROCK -- 'A Goon's Deed in a Weary World' Episode 711 -- Jack McBrayer as Kenneth Parcell NBCUniversal | Getty Images

You can list old gadgets on places like eBay and Craigslist, but I've had the most luck using a website called Swappa, which is popular in my circle of peers who buy and sell gadgets frequently. I like it because I don't have to meet anyone in person, like on Craigslist, and I haven't had problems with scammers like I have on eBay in the past. Here's how it works: You create a free Swappa account and then choose "Sell on Swappa" on the main page. You can list phones, cameras, laptops, tablets, smartwatches and other wearables, video games, VR headsets and even smart thermostats or an old Echo. Swappa will tell you the current lowest listed price in either new, mint, good or fair condition and recent prices for similar devices. If you price your gadget within that range, you should be able to sell it. Take a few pictures (this is required, along with a special number you include in the pictures to confirm it's you), post some information about it and then wait. I sold a Galaxy Note 9 earlier this year in just a few days. Swappa takes a flat fee out of your sale — it's free if you sell something up to $50 but gradually increases with the sale price. If you sell something for $1,000, Swappa takes a $35 fee. If you sell something for $6,000, Swappa keeps $250. Here are the fees you can expect to pay.

Recycle them

A photo of Daisy, Apple's recycling robot, and her battery cooling system. Apple

If you can't sell your device, be good to the planet and recycle it. "Recycling one million laptops saves the energy equivalent to the electricity used by more than 3,500 U.S. homes each year," according to the EPA. "For every million cell phones we recycle, 35 thousand pounds of copper, 772 pounds of silver, 75 pounds of gold and 33 pounds of palladium can be recovered." The EPA has a list of most of the major electronics makers in the U.S., complete with links to where you can recycle those products. Apple isn't on that list, but it has its own massive recycling program. Apple uses 100 percent recycled aluminum in its new MacBook Air, for example. You can see a picture of its iPhone recycling robot, Daisy, above. When you trade in a product, Apple either gives you credit or recycles it for you. Best Buy has collected and recycled more than 1 billion pounds of electronics and appliances. You can bring old electronics, even including old batteries, cords, cables and plastic bags, and leave them in a kiosk inside the front doors of a Best Buy. For gadgets, just bring them to the Customer Service counter.

Donate them

The sun sets behind a C-17 Globemaster as soldiers wait in line to board the aircraft. US Air Force photo