How to Get Bugs Out of Electronics and Keep Them Out

Bugs inside electronics are more common than most people expect, and getting them out safely requires patience. The biggest risk isn’t the insects themselves but the damage you can cause by using the wrong removal method. Spraying insecticide directly into a device can short-circuit and permanently kill it. Here’s how to clear out the pests without destroying your gear.

Why Bugs Move Into Electronics

German cockroaches are the most frequent offenders. They seek warm, dark, confined spaces, and electronics check every box. Devices that run continuously, like routers, modems, game consoles, and TVs, generate steady heat that draws roaches in. Refrigerator motors and power supplies are also common targets. Once inside, roaches find tight gaps between circuit boards and housing walls that mimic the crevices they naturally shelter in.

Ants are another common invader. Some species are attracted to electromagnetic fields and will cluster around wiring and circuit boards. Both roaches and ants leave behind debris, feces, and body oils that can corrode components over time, so the longer they stay, the more damage accumulates.

What Not to Do

The instinct to grab a can of bug spray is strong, but spraying insecticide into an electronic device is one of the fastest ways to destroy it. Aerosol insecticides contain petroleum distillates (solvents) and liquefied petroleum gas as propellants. When sprayed into a device, the rapid expansion of the aerosol can cause moisture from the surrounding air to condense on the circuit board. That moisture creates abnormal electrical connections between components that should be at different voltages, resulting in a short circuit. Once that irreversible damage is done, the device is dead.

Even if the device is powered off when you spray, residue from the solvents can linger on components and cause problems when you power it back on. The bottom line: never spray liquid insecticides, foggers, or aerosol pest products into or onto electronics.

Starve Them Out With Bait

The safest way to kill bugs inside electronics is to lure them out rather than chase them in. Place gel roach bait or bait stations around (not inside) the infested device. Roaches will leave the device to feed, carry the bait back, and the colony dies off over days to weeks. This method avoids introducing any liquid or chemical residue to the circuit board.

For the best results, place bait stations within a few inches of the device’s vents and openings. Keep the device powered off if you can, since removing the heat source makes the interior less attractive and encourages roaches to leave on their own. If you’re dealing with ants, gel bait formulated for ants works the same way.

The Freezing Method

Cold temperatures can kill insects at all life stages, including eggs. Research from Cornell’s Integrated Pest Management program shows that sustained temperatures of 0°F (the temperature of most household freezers) need to be maintained for four or more days to kill all stages of bugs and their eggs. Lower temperatures work faster: two days at -4°F, or near-instantly at -6°F to -22.5°F. But most home freezers hover right around 0°F, so plan on at least four full days.

Before placing a device in the freezer, seal it in a large plastic bag and remove as much air as possible. This limits moisture exposure. When you take the device out, leave it sealed in the bag and let it return to room temperature gradually. Opening it while it’s still cold causes condensation to form on the circuit board, which creates the same short-circuit risk as spraying liquid inside. Once the device feels fully room-temperature (give it several hours), you can unseal it.

One caution: freezing is generally safe for solid-state electronics, but devices with LCD screens or batteries can be damaged by extreme cold. Remove batteries before freezing when possible, and avoid this method for laptops or tablets unless you’ve removed the battery and are comfortable with the risk.

Using Compressed Air to Clear Debris

Once the bugs are dead or gone, you’ll want to blow out the carcasses, droppings, and egg casings left behind. Compressed air is one of the most common and accessible ways to clean inside electronics. Use short bursts aimed at vents and openings to push debris out. If you can safely open the device’s housing (many game consoles, desktops, and routers have removable panels), you’ll be able to direct the air more precisely.

Always power down and unplug the device before opening it. Hold the can of compressed air upright to avoid spraying liquid propellant onto the board. Work in a well-ventilated area, ideally outdoors, because roach debris carries allergens you don’t want to inhale.

Cleaning the Circuit Board

Roach feces are acidic and can corrode circuit board traces over time, so a deeper cleaning is worth the effort if the infestation was significant. The key supply is isopropyl alcohol at 90% concentration or higher. Avoid anything below 90% on circuit boards, since lower concentrations contain more water, which increases the risk of damage. 99% isopropyl is technically optimal but harder to find; 90% works well for most situations.

Power down the device and disconnect it from any power source. Dip a cotton swab in the isopropyl alcohol and gently wipe affected areas of the board to dissolve and lift residue. For loose dust and dry debris, a soft-bristle brush (a fine detail paintbrush works perfectly) can sweep particles away without scratching components. Let the board air-dry completely before reassembling and powering on.

If you notice greenish or white corrosion on the board, you can make a paste of baking soda and a small amount of deionized water, apply it gently with a soft brush, then wipe clean with a lint-free microfiber cloth. Dry the board thoroughly afterward. For heavy corrosion, placing the cleaned board on a baking sheet in an oven at the lowest setting for 10 to 15 minutes helps evaporate any remaining moisture, though this step is optional for light cleaning jobs.

Keeping Bugs From Coming Back

Removing bugs from a device only matters if they don’t return. The same conditions that attracted them in the first place, warmth and shelter near food sources, will draw them right back unless you address the environment.

Keep the area around electronics clean. Crumbs, spills, and pet food near a game console or TV stand are an open invitation. Move devices away from walls slightly to improve airflow and reduce the tight, sheltered gaps roaches prefer. If your device has dust filters, clean them regularly so airflow stays strong and the interior doesn’t become an undisturbed hiding spot.

For ongoing roach control, place bait stations near electronics but never spray residual insecticides directly on or into devices. Products containing an insect growth regulator can create a barrier in the surrounding area that lasts for months, breaking the breeding cycle before roaches ever reach your gear. Apply these to baseboards, under furniture, and along walls near your electronics setup, keeping the spray well away from the devices themselves.

If you’re dealing with a building-wide roach problem, no amount of device-level prevention will keep them out permanently. Addressing the broader infestation through bait, traps, and sealing entry points in your home is the only way to protect your electronics long-term.