In the garden: A vast range of plants (usually potted) where the compost is maintained in a damp condition.
On Crops: Young vegetable seedlings and indoor herbs
Tiny black flies, or gnats, are seen hovering around seedling trays or houseplants, or they may fly up when you wave your hand over the plants. The gnats themselves do not injure plants, but they lay eggs in damp soil, and their larvae strip away plant roots.
Seedlings fail to grow well despite good light and water, and you can see fungus gnats in the room or greenhouse. If you examine the roots of a failed seedling, the roots will be skimpy and there may be tiny, translucent worms present. To investigate further, place a cut piece of potato on the soil's surface and check it after 4 hours. Some of the larvae present in the soil will have migrated to the rich new food supply.
Check houseplants regularly for infestations, and remove old leaves from the surface of potted plants. When growing seedlings indoors, allow the soil to dry between waterings if the plants can tolerate it. Cover moist, newly seeded containers with plastic to exclude interested gnats. Place yellow sticky traps, oriented horizontally, near seedlings to nab adults.
Several commercial products labeled for indoor use that are based on the Israelensis strain of Bacillus thuringiensis give good results when applied as a soil drench. Repeat after two weeks to control new fungus gnat larvae that may have hatched from eggs resting in the soil.