Fungus Gnats and Aphids in a Smart Garden: Safe Fixes for Edibles
Gnats, aphids and spider mites all turn up in countertop gardens. Here is how to tell them apart, where they come from, and what is safe to use on herbs and greens you plan to eat.
Small black flies drifting up from your pods when you top off the water are almost always fungus gnats. Fungus gnats in a hydroponic garden are more of a nuisance than a threat to grown plants, but they breed fast and keep coming back if you only swat the adults. Aphids and spider mites are the other two pests owners run into most, and those can actually damage your crop.
Everything here is about plants you plan to eat. That rules out a lot of what is sold for houseplants, so the order matters: identify the pest, take away what it lives on, use physical fixes, and only then use a spray that is labeled for edible crops.
First, figure out what you have
Grab a flashlight and, if you have one, a magnifying glass. Check the tops of the pods, the deck, and both sides of the leaves.
Fungus gnats
Adults are delicate, dark, mosquito-like flies about 1/16 to 1/8 inch long, according to UC IPM and Oregon State Extension. They are weak fliers, hang around the pods and the light, and lift off when you disturb the plant. The larvae are the part that matters: tiny, legless, see-through worms with a shiny black head that live in wet growing media and feed on decaying organic matter and sometimes young roots.
At 75°F (24°C), UC IPM says eggs hatch in about 3 days, larvae feed for about 10 days, and adults appear about 4 days after that. A whole generation takes about 17 days. That is why one batch of traps never seems to finish the job.
Aphids
Aphids are soft, pear-shaped insects in green, yellow, black, brown or red, clustered on the undersides of leaves and on soft new growth. UC IPM points to two small tubes sticking out of the rear end as the giveaway. They do not run when you touch them. Look for sticky residue (honeydew) on leaves below a colony and curled new leaves. Large colonies yellow and stunt plants.
Spider mites
These are harder to see. Washington State University describes them as about the size of a period. The first sign is usually fine pale speckling on the leaf surface, then thin webbing on the undersides and between stems. Hold a white sheet of paper under a leaf and tap it. If tiny specks start walking around, you have mites. Warm, dry indoor air suits them.
Whiteflies and thrips
These show up less often on a countertop. UConn groups whiteflies and thrips with aphids and mites as soft-bodied pests, so the same rinse and soap approach below applies to them.

Where fungus gnats in a hydroponic garden come from
People are often confused that gnats appear in a garden with no soil. They do not need soil. They need moist organic material, and a smart garden has plenty of it.
- The tops of the grow sponges. Most pods use peat or coir plugs, and the top stays damp. Colorado State material notes that peat-rich media can favor fungus gnats.
- Algae. Any light hitting wet surfaces grows green film, which Rise Gardens lists as a breeding signal along with standing water around the reservoir.
- Dead plant matter. Fallen leaves in the bowl, a seedling that died in its pod, or roots left behind from a finished crop.
- Houseplants nearby. Oregon State lists overwatered potting soil and plants brought home without inspection as main sources. Rise Gardens says soil-rooted plants and cuttings are the most common way gnats get into a clean indoor grow. If your garden sits near a potted plant, check that pot first.
Gnats are also not quite harmless. Penn State Extension notes that fungus gnat larvae can spread Pythium, the water mold behind most root rot.
Getting rid of gnats without spraying your food
Plan on two to three weeks, because you are waiting out several generations. Rise Gardens puts most cleanups at 7 to 14 days with traps plus a larval treatment, and up to 21 days for bad ones.
Catch the adults
Yellow sticky traps work and are cheap. Oregon State suggests small 2 by 2 inch cards, replaced every few days. Rise Gardens says to place them within 6 inches of the plants at canopy height, not up high, and check them every 2 to 3 days. If a trap keeps filling, the larvae are still active below. Keep traps out of reach of curious pets and kids; our guide to smart gardens with cats and kids covers placement.
Traps alone do not end an infestation. They remove egg-laying adults and tell you whether your other fixes are working.
Dry out and cover the breeding spots
In soil, the advice is to let the top inch dry between waterings. A hydroponic pod stays wet by design, so instead you cut off the surface. Make sure every empty hole has its cap or light shield, and wipe up standing water on the deck. Fish out fallen leaves and pull dead seedlings along with their sponge. Our article on stopping algae and mold covers blocking light from wet surfaces, which also takes away the green film larvae feed on.
To check whether larvae are in a pod, UC IPM suggests setting a chunk of raw potato cut side down on the medium for a few days. Larvae gather under it.
Kill the larvae
Bti (Bacillus thuringiensis israelensis) is a bacterium that kills fly larvae and nothing else, sold as Gnatrol or as Mosquito Bits and Mosquito Dunks. UC IPM says it does not last long indoors and may need repeating about every five days. Oregon State describes soaking it in water for about 30 minutes and pouring the liquid onto the medium. One caution from a UBC Botanical Garden forum: Bti products are not registered for hydroponic reservoirs, so dropping them into the nutrient water is off label. I would treat the pod tops with the soaked liquid rather than the tank, and read the label of the product you buy.
Beneficial nematodes (Steinernema feltiae) are microscopic worms that hunt larvae in moist media. UC IPM says they work from 60 to 90°F (16 to 32°C), which suits a kitchen, and give longer control after several applications. They are mail order and need to be used soon after they arrive.
Hydrogen peroxide is common advice online, but I would be careful. Rise Gardens suggests a strong mix of 1 part 3% peroxide to 4 parts water on the medium or reservoir, while the same company recommends only 3 mL per gallon for root health elsewhere. Those numbers are wildly apart, and peroxide strong enough to kill larvae can damage roots. In a small countertop tank, I would stick with traps, Bti on the pod tops and cleanup.
Aphids and mites: rinse first, soap second
Water and scissors
A strong stream of plain water knocks aphids off sturdy plants, and UC IPM notes most cannot climb back. Do it early in the day so leaves dry. Washington State recommends rinsing mite-covered plants in lukewarm water, paying attention to the undersides, and repeating at least weekly. On a countertop garden you cannot carry the plant to the shower, so a spray bottle of plain water aimed at the undersides does the job, with a towel over the deck to keep runoff out of the tank. Snip off the worst leaves and stems and throw them in the trash, not the compost.
Check twice a week for a while. UC IPM suggests checking at least that often during fast growth.
Insecticidal soap labeled for edibles
If rinsing does not keep up, insecticidal soap is the extension services’ preferred next step for soft-bodied pests like aphids, mites, whiteflies and thrips. UConn’s fact sheet notes many formulations can be used on food crops up to the day of harvest, but only if the label says so. Look for vegetables or herbs on the label, not only houseplants.
How to use it well, based on UConn and UC IPM:
- It only works on contact. Pests have to be wet with it. Coat the undersides of leaves.
- It leaves nothing behind once dry, so plan to repeat as the label directs.
- Test first. Spray one leaf or one plant and wait at least 24 hours for spotting or burned edges before treating everything.
- Skip stressed plants and young seedlings. UConn says young transplants and soft new growth are more likely to be damaged.
- Use soft water if yours is hard. Minerals bind with the soap, reduce how well it works and raise the risk of leaf injury.
I would also keep soap out of the reservoir. UConn notes it is toxic to aquatic life, and I see no reason to add it to the water your roots sit in.
Rinse leaves well before you eat them, even if the label allows same-day harvest.
What not to spray on plants you eat
Washington State is blunt: chemical controls for spider mites are not recommended on edible plants grown indoors for cooking. That covers more than mites. A few specific things to leave alone:
- Houseplant sprays. If the label lists ornamentals and houseplants but not vegetables or herbs, it is not for your basil.
- Dish soap and homemade mixes. UConn says dish soaps and detergents are not labeled as pesticides and can strip the waxy layer that protects the leaf. UF/IFAS notes any soap can burn leaves.
- Pyrethrin and pyrethroid foggers or sprays. UC IPM treats these as a last resort for gnats, used only per a label that covers your use, and recommends taking plants outdoors to spray. That is impractical with a plugged-in garden.
- Systemic insecticides. Products that soak into the plant are meant for ornamentals. UC IPM says that in California, as of January 2025, they are only available to licensed professionals.
- Neem oil without checking the label. Some neem products list vegetables and herbs, others do not. Several gardening sources also warn that herbs like basil, cilantro, dill and parsley can react badly to it. Test a leaf if you use it.
When one plant is overrun, the simplest fix is often to pull it. Oregon State and Washington State both suggest discarding heavily infested plants to protect the rest. A mint or basil pod is cheap to replace, and a fresh start beats weeks of spraying.
Keeping pests out next time
Most outbreaks arrive from somewhere else. A few habits stop the next one:
- Quarantine new plants. Oregon State suggests keeping new houseplants separate for a few weeks with a sticky trap and checking them daily before setting them near your garden.
- Clean between grows. Rinse or replace pods, pull all old roots, and scrub the bowl. Rise Gardens advises rinsing reused parts so old root matter does not harbor larvae.
- Keep the deck dry and capped. No standing water, no open holes, no fallen leaves.
- Look under leaves every week. Aphids and mites are far easier to rinse off when there are ten than when there are hundreds. Our weekly maintenance routine builds this in.
If root problems show up along with gnats, check the roots and the pump too. Our pump cleaning guide helps when slow water flow keeps the bowl stagnant.
-
Why do I have gnats in my hydroponic garden?
Fungus gnats breed in moist organic material, such as damp tops of peat or coir pods, algae film and dead leaves or roots. They also often arrive from overwatered houseplants nearby.
-
Do fungus gnats hurt hydroponic plants?
Adults do not bite or damage plants. Larvae can chew on roots and stunt seedlings, and Penn State notes they can spread the water mold that causes root rot.
-
Is insecticidal soap safe for herbs I eat?
Many insecticidal soaps can be used on food crops up to the day of harvest, but only if the label lists vegetables or herbs. Test on one leaf first and rinse before eating.
-
Can I put Mosquito Bits in my hydroponic reservoir?
Bti products are not registered for hydroponic reservoirs, so adding them to the tank is off label. Soaking them in water and applying the liquid to the pod tops follows extension advice for soil more closely.
-
How do I get rid of aphids on indoor basil?
Spray them off with plain water every few days, focusing on leaf undersides, and snip off the worst stems. If they keep coming back, use an insecticidal soap labeled for edible plants.
-
How long does it take to get rid of fungus gnats?
Expect two to three weeks. A generation takes about 17 days at 75°F, so you need to keep traps up and treat larvae until the traps stay empty.