If you live in North America and see small black worms in the house, especially under the sink, be thankful you don't live in Portugal or Australia, where Portuguese millipedes (Ommatoiulus moreleti) are common. If you don't like worms, you won't like these shiny black, undulating creatures, and if you see one of them, you can be sure there are hundreds more around in places you can't see them.
The comparatively undramatic black worms in North American kitchen cabinets are probably either another species of millipede (class: Diplopoda) or drain fly larvae (family: Psychodidae). Like Portuguese millipedes, the millipedes you find in North America are benign, but who wants a mass of crawling worms under the sink? Drain fly larvae are technically immature flies and not worms, and they're not dangerous either, but they're still pests.
The Small Black Worms in the House Are Looking for Moisture
The reason you see little black worms in the shower, basement or under the kitchen sink, and not in exposed areas of the living room, is that they're looking for moisture. Small, confined spaces with a lot of humidity or condensation are ideal places for them to hang out and breed.
In the case of drain fly larvae, the flies themselves are living in the drains, and you'll normally find the larvae at or near the drain opening. If the flies can get access to the cabinet, either by going through a crack in a pipe or by entering through a gap in the cabinet door, they'll lay their eggs in the cabinet if there's enough moisture. The larval stage lasts from 9 to 18 days, so if you do nothing, the worms will disappear, but you'll soon be inundated by drain flies.
Drain flies are also known as sewer gnats, which gives you an idea of why you don't want them flying around your house. They don't bite or sting, but they live near decaying organic matter and can carry pathogens. If you see the larvae, it's actually a good thing because they're easier to control than the adult flies.
Controlling Black Worms in the House
If the black worms on the bathroom floor or the ones under the kitchen sink are looking for moisture, the strategy for controlling them is clear. Get rid of the moisture. In the bathroom, that might mean you have to run the exhaust fan more often. If they're under the sink, you may have to open the door and ventilate with a fan for several days.
Neither millipedes nor drain fly larvae can survive for long without moisture, so other than drying out the spaces in which you find them, no other control methods are needed. You don't have to blast them with pesticide; you probably don't need the extra noxious fumes floating around in your house anyway.
What to Do About Drain Flies
If you see little black worms in the shower drain, you could kill them by refraining from using the shower for a week or two, but failing this, the recommended way to treat them is to pour an enzyme drain cleaner down the drain. The enzymes eat the organic matter in the drain, making the drain much less attractive to the flies. Drain flies don't live longer than a month, so if the drain is free of gunk, that's the longest you should have to wait before you stop seeing flies and their larvae.
Chris Deziel is a contractor, builder and general fix-it pro who has been active in the construction trades for 40 years. He has degrees in science and humanities and years of teaching experience. An avid craftsman and musician, Deziel began writing on home improvement topics in 2010. He worked as an expert consultant with eHow Now and Pro Referral -- a Home Depot site. A DIYer by nature, Deziel regularly shares tips and tricks for a better home and garden at Hunker.com.