How Does a Black Swallowtail Caterpillar Know to Eat Dill?

A newly hatched black swallowtail caterpillar has never seen a plant before, yet it starts eating dill within minutes of leaving the egg. It does not learn to recognize dill, and it does not go searching for the right leaf. The work was already done by its mother. Before she laid that egg, the female butterfly landed on the plant and tasted it with her feet to confirm it was the correct host. By the time the caterpillar hatches, it is already sitting on its first meal.

This is one of the most fascinating things we get to watch in our North Texas container garden, where Mandi (@mrsmandivaughn) raises black swallowtails on dill and bronze fennel grown a few feet from the back door. Below is exactly how the mother chooses the plant, what that tasting behavior is called, and why the caterpillar hatches onto the one plant it can actually eat.

Female black swallowtail on dill in Mandi Vaughn's container garden, tasting the plant before laying eggs

This post contains affiliate links. We may earn a small commission on qualifying purchases at no extra cost to you. We only link to products we use and recommend. See our full affiliate disclosure.

The Short Answer: The Caterpillar Does Not Have to Know

The caterpillar does not identify dill on its own. Host-plant selection happens one generation earlier, when the adult female decides where to place each egg. She is the one doing the identification, and she is remarkably picky about it. Black swallowtails lay their eggs almost exclusively on plants in the carrot and parsley family, so a hatchling almost always opens its eyes onto exactly the plant it needs.

That is why caterpillars seem to "know" what to eat. The knowing is really the mother's, expressed through where she lays. If you want to understand how a caterpillar ends up on dill, you have to start with the butterfly and her feet.

Why Dill, Fennel, and Parsley (and Almost Nothing Else)

Black swallowtail caterpillars are specialists. They feed on plants in the carrot family, known botanically as the Apiaceae, which includes dill, fennel, parsley, carrot tops, and celery. According to the University of Wisconsin Horticulture Extension, cultivated dill, parsley, fennel, celery, caraway, and carrot are all common host plants.

Females also lay on wild relatives in the same family. Queen Anne's lace, which is really just wild carrot, is a common wild host, and so are some of its cousins out in fields and ditches. There is one interesting exception too. Black swallowtails will occasionally use rue, which sits in the citrus family rather than the carrot family. Rue works because it shares similar defensive chemistry with the carrot-family plants, so the caterpillars are equipped to handle it even though it is not a close botanical relative.

Here is what makes that narrow diet so interesting. Plants in the carrot family produce natural compounds called furanocoumarins that deter or poison most insects that try to eat them. Most bugs cannot handle these chemicals. Black swallowtail caterpillars can, because they carry specialized detox enzymes that break the toxins down. That adaptation lets them feed on a plant that most other insects have to avoid, which means less competition and a reliable food source.

So the "right plant" is not just a preference. It is the small set of plants the caterpillar is biologically equipped to survive on. Getting it wrong would be a death sentence for the hatchling, which is exactly why the mother's plant check matters so much.

Two black swallowtail caterpillars feeding on dill flowers in Mandi Vaughn's garden

Tarsal Drumming: How the Mother Tastes a Plant With Her Feet

A female black swallowtail does not taste a plant with her mouth. She tastes it with her feet. Butterflies carry contact chemoreceptors, tiny taste sensors, on the lower segments of their legs called the tarsi. When a female lands on a candidate plant, she rapidly taps and scratches the leaf surface with her front legs. This behavior is called tarsal drumming.

The drumming does something specific. Scratching the leaf releases the plant's juices, and those juices wash over the taste sensors on her feet. The Monarch Joint Venture describes the same behavior in monarchs: females drum their legs against the leaf to release plant fluids, and the chemoreceptors along their legs tell them whether they are standing on the correct host. The Missouri Department of Conservation notes that swallowtails literally taste their potential host plants with their feet.

Every plant family has its own chemical fingerprint. The carrot family produces its own signature blend of compounds, and a female swallowtail is tuned to read it. If the drum test comes back as a match, she moves toward laying. If it does not, she leaves, even if the plant looks similar to the human eye. That chemical check is why she rejects lookalikes that would poison her offspring and only commits to the real thing.

Mandi filmed this behavior in the garden. You can watch her tarsal drumming explanation on her page.

Freshly emerged black swallowtail butterfly on a hand showing its blue and orange eyespot

One Egg at a Time, on the Confirmed Plant

Once a female confirms the plant, she does not dump a cluster of eggs and move on. She curls her abdomen under and places a single round egg on the leaf, then repeats the process, often across several plants. Over a short adult life of roughly two to four weeks, a female can lay up to around 400 eggs, one at a time.

Spreading eggs out this way is a survival strategy. In the wild, only a small fraction of eggs make it all the way to adulthood, so laying single eggs across many confirmed host plants gives more of them a fighting chance. Mandi captured a female doing this in the garden one morning, including a close-up of a single egg on their dill, and another clip of a new generation getting started with a female laying while more than a dozen caterpillars fed nearby.

The key point is that placement is deliberate. Every egg is set down only after the plant passed the drum test, which is what sets up the next part.

The Egg Hatches Onto Its First Meal

Because the mother already confirmed the plant, the egg is sitting exactly where it needs to be. When the tiny caterpillar hatches, its first host plant is right underneath it. There is no searching, no wandering, and no guessing. It hatches and it eats.

This is the whole answer to how a caterpillar "knows" to eat dill. It does not need to know, because it was never given a choice to get wrong. The female made the decision when she tasted the leaf with her feet and laid the egg there. The hatchling simply inherits a correct starting point.

Early-instar black swallowtail caterpillar in its bird-dropping stage on dill in Mandi Vaughn's garden

The Caterpillar Runs Its Own Taste Test Too

There is a nice bookend to all of this. The caterpillar has its own way of tasting, and it uses it when it needs to move to a new plant. Instead of tarsal chemoreceptors on its feet, a caterpillar tastes with sensors in its mouthparts. When it meets an unfamiliar leaf, it reads the surface, then takes a small test bite so its taste sensors get a full read of the sap before it commits.

We watched this happen when one of our caterpillars had only ever eaten dill and then had to move onto bronze fennel. Dill and fennel are both in the carrot family and share the same chemistry, so the test bite came back as a match and the caterpillar settled in. Mandi filmed that caterpillar taste test moving from dill to fennel. One generation picks the plant with her feet, and the next generation confirms it with its mouth.

Plant Extra and Watch It Happen

If you want to see this in your own garden, the move is simple: grow the host plants and plant enough to share. Females lay right on dill, fennel, and parsley, and a hungry group of caterpillars can strip a small planting fast, so we grow ours generously. Last year we did not grow enough dill, so this year Mandi seeded a 25-gallon container heavily, almost like a tray of microgreens, and let it bolt so it would keep offering fresh growth. Fabric grow bags and large containers both work well for this, and you can find the fabric bags and container basics on our Garden Fertilizers and Fabric Grow Bags list. For more on why we grow so much in containers, see our post on why we use fabric grow bags for our backyard garden.

Our garden is strictly no-spray, no pesticides and no herbicides of any kind. That is a deliberate choice, and it is what lets butterflies, caterpillars, and the beneficial predators that keep pests in check all share the same space. Skip the sprays, plant host plants for the caterpillars and nectar flowers like zinnias for the adults, and the swallowtails will find you. For the full picture on North Texas pollinator plants, our guide to pollinator-friendly gardens in Hunt County pairs well with this post.

You can see the black swallowtail lifecycle from the field guide side too. The Texas A&M Field Guide to Common Texas Insects is a solid regional reference for identifying them here in Texas.

Mature black swallowtail caterpillar on flowering dill in Mandi Vaughn's North Texas garden

Frequently Asked Questions

What is tarsal drumming?

Tarsal drumming is the behavior where a female butterfly rapidly taps and scratches a leaf with her front legs before laying eggs. The scratching releases the plant's juices onto contact chemoreceptors, taste sensors, located on her feet. This lets her read the plant's chemistry and confirm it is the correct host plant for her caterpillars.

How does a butterfly know which plant to lay eggs on?

She tastes it with her feet. A female butterfly carries taste sensors on the lower segments of her legs, and by drumming on a leaf she samples the plant's chemical fingerprint. Each plant family has its own chemical signature, so she can confirm the right host and reject lookalike plants that would harm her offspring.

Why do black swallowtail caterpillars only eat plants in the carrot family?

Plants in the carrot family, like dill, fennel, parsley, and carrot tops, produce natural compounds called furanocoumarins that deter or poison most insects. Black swallowtail caterpillars carry specialized detox enzymes that neutralize these chemicals, so they can feed on plants most other insects cannot. That narrow diet is what they are biologically built for. They will also use a few plants outside the carrot family, like rue, that share similar defensive chemistry.

Do caterpillars taste their food?

Yes. A caterpillar tastes with sensors in its mouthparts rather than its feet. When it encounters a new leaf, it reads the surface and takes a small test bite so its taste sensors can sample the sap before it commits to eating. This is how a caterpillar can confirm a new plant, such as moving from dill to fennel, which share the same chemistry.

What should I plant to attract black swallowtails?

Plant host plants for the caterpillars and nectar flowers for the adults. Dill, fennel, and parsley give females a place to lay eggs and give caterpillars their food, and nectar flowers like zinnias feed the adult butterflies. Plant more host plants than you think you need, since caterpillars eat a lot, and keep the garden spray-free.

Final Thoughts

The reason a black swallowtail caterpillar knows to eat dill is that it never had to figure it out. Its mother tasted the plant with her feet, confirmed the chemistry with a quick drum test, and laid the egg on the one plant her caterpillar could survive on. The caterpillar just hatches and starts eating. It is a small, quiet piece of the garden that most people walk right past, and it is happening on herbs you can grow in a single container.

If you want to raise them start to finish, our full guide to raising black swallowtail butterflies in a container garden walks through every stage, from egg to emergence. You can follow along with more of Mandi's macro and garden work on @mrsmandivaughn and Mandi Made It, and browse the rest of our Garden and Pollinator Blog for more from the backyard.

Related Blogs

Happy growing!

Leave a comment