Where Do Worms Come From? Soil, Pets & Parasites

Worms come from eggs. Every worm you encounter, whether it’s an earthworm on your sidewalk or a parasite in a pet, hatched from an egg laid by a parent worm. This might sound obvious, but for centuries people believed worms materialized spontaneously from mud, rotting food, or decaying flesh. In the 1600s, the Italian scientist Francesco Redi proved that wrong with a simple experiment showing that maggots only appeared on meat when flies could reach it to lay eggs. The same principle applies to every type of worm: they all have a source.

Where Earthworms in Your Yard Come From

Earthworms reproduce by depositing small, lemon-shaped cocoons in the soil. Each cocoon contains fertilized eggs that hatch into tiny worms after an incubation period that varies with temperature and species. In warmer months, cocoon production spikes dramatically, which is why earthworm populations seem to explode in spring and summer. During winter, reproduction slows or stops entirely.

Earthworms are hermaphrodites, meaning each individual has both male and female reproductive organs, but they still need a partner. Two worms exchange sperm, and each produces cocoons afterward. The cocoons are small enough to go unnoticed in soil, roughly the size of a grain of rice, so the worms seem to appear from nowhere. A single acre of healthy soil can hold anywhere from about 285,000 to 2 million earthworms, most of them living their entire lives underground and out of sight.

If you’ve ever wondered why worms suddenly appear on sidewalks and driveways after rain, the leading explanation is surprisingly practical: wet surfaces make it easier for them to travel. Earthworms breathe through their skin and need moisture to survive, so a rainy day is their best opportunity to migrate to new territory, find food, or locate a mate. The vibrations from raindrops hitting the ground also seem to trigger them to leave their burrows.

How Worms First Evolved

Worm-like creatures are among the oldest animal forms on Earth. The earliest ancestors of modern annelid worms (the group that includes earthworms) first appeared in the ocean over 500 million years ago during the Cambrian Period. Fossils of their soft bodies have been found at multiple sites dating to between 540 and 485 million years ago, a stretch of time known as the Cambrian Explosion when nearly all major animal groups first showed up in the fossil record. Worms eventually colonized freshwater and then land, where they became essential to soil ecosystems.

Where Parasitic Worms in Humans Come From

Parasitic worms that infect people come from specific, well-understood transmission routes. The type of worm determines how it gets into your body.

Pinworms are the most common worm infection in the United States. They spread through a frustratingly simple cycle: an infected person (usually a child) scratches the itchy area around their anus where female pinworms lay eggs at night, picks up microscopic eggs under their fingernails, and transfers them to surfaces, food, or other people. The eggs are so small they can even become airborne in dust and be inhaled or swallowed. This is why pinworm outbreaks are common in schools and daycares.

Hookworms take a different route entirely. Their larvae live in contaminated soil and can penetrate the skin of your feet when you walk barefoot. One species can also be swallowed with contaminated food. Hookworm transmission is most common in tropical and subtropical areas with poor sanitation.

Roundworms and whipworms spread when their eggs, shed in human feces, contaminate soil. You can swallow the eggs by eating unwashed vegetables grown in that soil, drinking contaminated water, or touching contaminated dirt and then putting your hands near your mouth.

Tapeworms come from eating undercooked meat or fish that contains larvae. The larvae are embedded in the animal’s muscle tissue and survive unless the meat reaches a core temperature of 60 to 75°C (140 to 167°F) and stays there for at least 15 to 30 minutes. This is why thorough cooking is the single most effective defense against tapeworm infection from food.

Where Worms in Pets Come From

Dogs and cats pick up worms through many of the same routes humans do, just more frequently because of how they interact with their environment. Puppies and kittens often acquire roundworms before birth or through their mother’s milk, which is why veterinarians recommend deworming young animals on a schedule. After that, pets get reinfected by sniffing or eating contaminated soil, feces from other animals, or prey like rodents and birds that carry larvae in their tissues.

Hookworm larvae in soil can burrow through the pads of a dog’s feet, just as they penetrate human skin. Tapeworms in pets typically come from swallowing fleas during grooming, since flea larvae eat tapeworm eggs and carry the developing parasite inside them. This is one reason flea prevention and worm prevention go hand in hand.

Why Worms Seem to Appear From Nowhere

The reason worms seem to materialize out of thin air is that their eggs are either microscopic or hidden underground. Earthworm cocoons sit buried in soil where you’ll never spot them. Pinworm eggs are invisible to the naked eye. Tapeworm larvae are sealed inside meat tissue. In every case, the worms were already there in egg or larval form, waiting for the right conditions: warm soil, a new host, or an unwashed hand. Understanding where they actually come from makes it much easier to prevent the ones you don’t want and appreciate the ones, like earthworms, that keep your soil alive.