What to Spray to Get Rid of Gnats and Their Larvae

Gnats are small, flying insects often found indoors, requiring a two-part strategy for effective elimination. The most frequently encountered types are fungus gnats, fruit flies, and drain flies, each with a distinct breeding source. Simply killing the visible, flying adults provides only temporary relief because the next generation of larvae is already developing in the moist soil, decaying matter, or drain sludge. To resolve an infestation, any plan must address both the adult population and the hidden breeding grounds where the larvae thrive.

Direct Contact Sprays for Immediate Knockdown

Direct contact sprays are the quickest way to reduce the visible population of adult gnats. Commercial aerosol sprays containing pyrethrins or pyrethroids offer an immediate knockdown effect. These sprays are neurotoxins that quickly paralyze the insect, but they offer no residual effect once the spray has dried, meaning they will not prevent new gnats from emerging.

A highly effective do-it-yourself alternative is an insecticidal soap spray, which acts as a physical killer. This spray is typically a mixture of water and potassium salts of fatty acids, or a small amount of liquid dish soap. The fatty acids break down the insect’s protective outer layer (cuticle), causing the pest to rapidly dehydrate and die. Since these sprays must physically coat the insect to work, they are only effective against the adult gnats that are flying or resting at the time of application.

Eliminating Larvae and the Breeding Source in Soil

Eradicating fungus gnat larvae in the soil is the most important step for long-term control, as they feed on plant roots and quickly mature into new adults. A primary method involves a soil drench using products containing the naturally occurring bacterium Bacillus thuringiensis israelensis (Bti). Bti is a biological larvicide that specifically targets the larvae of certain flies, including fungus gnats and mosquitoes, and is safe for plants, pets, and humans.

When applied as a soil drench, the larvae ingest the Bti spores, which release a protein toxin that paralyzes their digestive system, causing them to die within a few days. Bti is available in various forms, such as granules or “mosquito bits,” which are steeped in water before being used to water plants. Repeat applications are necessary (typically every one to two weeks) to ensure newly hatched larvae are exposed before they develop into flying adults.

Another effective chemical-free drench uses hydrogen peroxide diluted with water (often 1 part 3% peroxide to 4 parts water). When this solution is poured onto the soil, the hydrogen peroxide reacts with organic matter, releasing oxygen that temporarily aerates the soil and kills the soft-bodied larvae and eggs on contact. The visible fizzing confirms the chemical reaction is taking place, and the mixture quickly breaks down into harmless water and oxygen. Cultural controls, like allowing the top inch or two of soil to dry out completely between waterings, also reduce the moist environment ideal for gnat egg-laying.

Source Control and Trapping for Non-Plant Gnats

Gnat control outside of houseplants requires identifying and eliminating the specific breeding source, often involving fruit flies or drain flies. Fruit flies are strongly attracted to the scent of fermentation from overripe fruit, spillage, or organic residue in trash cans. A simple and effective trapping method uses apple cider vinegar, which mimics the aroma of fermenting food.

The trap is made by filling a small container with apple cider vinegar and adding a drop of liquid dish soap. The vinegar attracts the flies, and the soap breaks the surface tension of the liquid, causing the flies to sink and drown instead of landing on the surface. Drain flies breed in the gelatinous biofilm lining drains; spraying is ineffective because the larvae are protected deep within the sludge.

Elimination for drain flies must focus on physical removal of the organic matter, accomplished by scrubbing the inside of the pipe with a long, flexible brush. Follow-up treatments with enzyme-based drain cleaners or a mixture of baking soda and vinegar can help break down the remaining film without damaging plumbing. Sticky traps (small yellow cards coated with adhesive) supplement source control methods, monitoring and capturing adult gnats to prevent new egg-laying.