The “worms” in your basement are almost certainly not worms at all. In most cases, they’re millipedes, insect larvae, or earthworms that wandered in from saturated soil. Each one looks different, shows up for different reasons, and requires a different fix. Identifying what you’re actually dealing with is the first step to clearing them out.
What You’re Probably Looking At
The most common culprits fall into three categories, and telling them apart is straightforward once you know what to look for.
Millipedes: These are the classic “little brown worms” that curl into a tight coil when you touch or disturb them. They have long, segmented bodies that make them look like worms, but they’re arthropods with dozens of tiny legs visible up close. They’re harmless to you and your home, but they’re a reliable sign that your basement has a moisture problem.
Drain fly larvae: If the creatures are small, dark, and clustered near a floor drain or along damp walls, you’re likely seeing the larvae of drain flies (also called moth flies). The adults are tiny, fuzzy, moth-like insects only 2 to 4 millimeters long, gray or tan with spotted wings. The larvae feed on the organic sludge that builds up inside pipes, especially in drains that don’t get regular use. They go through four growth stages over roughly 18 days before becoming flying adults.
Earthworms: Actual earthworms sometimes end up on basement floors after heavy rain. Rain vibrations drive them to the surface, and they travel more easily across wet ground to find food or mates. If your foundation has cracks or gaps, they can follow moisture gradients right inside. You’ll recognize them by their smooth, pinkish-brown bodies and the fact that they don’t curl into a ball like millipedes do.
Why They’re Getting In
Every one of these creatures needs moisture to survive. A dry basement doesn’t attract them. The specific trigger depends on which pest you have, but the root cause is always the same: water is getting where it shouldn’t be.
For millipedes, the typical path starts outside. They breed in moist mulch, leaf litter, and organic debris piled against your foundation. When populations grow or conditions change (a heavy rainstorm, a sudden cold snap), they migrate indoors through gaps under doors, cracks in foundation walls, or unsealed utility penetrations. If you have mulch touching your house, that’s often the staging area.
Drain fly larvae don’t enter from outside. They breed directly inside your plumbing. The prime habitat is a drain that sits unused for weeks or months, like a guest bathroom shower drain or a basement floor drain. Water collects in the trap and stagnates while soap scum, algae, fungi, and bacteria form a film on the pipe walls. That sludge is their food source and nursery. They can also develop under leaking pipes where water pools in hidden spots. Larvae sometimes enter from sewer lines that back up into the home.
Earthworms come in almost exclusively during or after rain events, through foundation cracks at or below grade. If you only see them after storms, that’s your confirmation.
How to Get Rid of Them
Millipedes
Start outdoors. Pull mulch, leaf piles, and any organic ground cover back at least 6 to 12 inches from your foundation. This eliminates their breeding habitat right next to your entry points. Check that door thresholds and basement windows are tightly sealed, and fill any visible cracks in the foundation with caulk or hydraulic cement. Indoors, a vacuum is the most practical way to remove the ones already inside. They die quickly in dry conditions, so improving your basement’s humidity (more on that below) solves the problem long-term.
Drain Fly Larvae
The fix is cleaning the drain, not killing the flies. Adults only live a couple of weeks, but they’ll keep reproducing as long as organic buildup remains in your pipes. Start by scrubbing the drain opening and the surrounding floor with standard cleaning supplies. Then use a drain snake or stiff pipe brush to physically remove the sludge lining the inside of the pipe.
For lighter buildup, pour a mixture of baking soda and vinegar into the drain, let it sit for 15 to 30 minutes, then flush with hot water. Boiling water can help clear stubborn residue, but only use it if you have metal pipes. Boiling water can damage PVC. For heavy infestations, a chemical drain cleaner may be necessary to break through the blockage.
Diatomaceous earth, a nontoxic powder made from fossilized algae, can be sprinkled in and around drains to kill larvae and adults on contact. It’s safe for people and pets, though you should avoid breathing in the dust while applying it. Leave it overnight for best results.
If the infestation keeps coming back after thorough drain cleaning, that can point to a broken pipe or hidden leak under your slab or in a crawlspace. At that point, you’re dealing with a plumbing issue, not just a pest issue.
Earthworms
Earthworms on your basement floor are a symptom of water intrusion. Seal foundation cracks, ensure your gutters direct water well away from the house, and check that the grading around your foundation slopes away from the walls. The earthworms themselves are harmless and can simply be swept up or returned outside.
Controlling Basement Humidity
No matter which pest brought you here, humidity control is the long-term solution. The U.S. Department of Energy’s ENERGY STAR program recommends keeping indoor humidity between 30 and 50 percent. Once levels climb above 50 percent, conditions start favoring pests. At 70 to 80 percent humidity, especially combined with temperatures around 75 to 80 degrees Fahrenheit, you create an environment that actively attracts insects, mites, and moisture-loving arthropods.
A dehumidifier is the most direct fix for a damp basement. Place it centrally, set it to hold humidity at or below 50 percent, and empty or plumb the reservoir regularly. Beyond that, check for and repair any sources of water entry: leaking pipes, condensation on cold water lines, cracks in walls or floors, and poor exterior drainage. A basement that stays dry doesn’t give these creatures a reason to show up.
Preventing Them From Coming Back
Once you’ve cleared the current infestation, a few habits keep it from recurring. Run water through every basement drain at least once a week to refresh the trap and prevent the stagnant conditions drain fly larvae need. Keep a regular schedule for cleaning drains, even those you rarely use. Maintain the 6 to 12 inch gap between mulch or landscaping and your foundation walls. Inspect door sweeps, window seals, and utility entry points at least once a season, resealing any gaps. And keep your dehumidifier running through the warmer months, when basement humidity tends to spike. These are small maintenance tasks, but together they remove the moisture and organic matter that every basement “worm” depends on.