Plants That Deter Garden Pests: A Practical Guide

Plants that deter garden pests can help, but they are not a force field. Match flowers and herbs to the pest, then build a realistic garden plan.

By · Reviewed by LeafyPixels Review Board · Published · Updated · 18 min read

Mixed vegetable garden bed with onions, leafy greens, broccoli, and peppers

Can you deter garden pests with just plants? Sometimes—but “deter” is the important word. A well-chosen companion can make a crop harder for an insect to find, provide nectar for a predator, or draw a pest toward a sacrificial plant. It usually cannot stop a large infestation, protect every crop in a bed, or replace a row cover when a caterpillar is already laying eggs.

The most useful way to think about pest-repellent plants is as one layer of an integrated pest management plan. You are designing a garden that is less convenient for the pest and more supportive of the insects, birds, soil life, and growing conditions that keep pest numbers from exploding. The result is often less damage and fewer emergency sprays—not a garden with no insects.

The short answer: plants can lower pest pressure, not guarantee a pest-free garden

Plants help through several different jobs that are often collapsed into the vague phrase “repel bugs.” Aromatic foliage may interfere with host-finding at close range. Flowering herbs may keep hoverflies, lacewings, lady beetles, and parasitoid wasps supplied with nectar. A trap crop may give a pest something more attractive to eat. Mixed plantings can also break up a large block of one host crop.

The distinction matters because each job has a different expectation. A border of lavender several feet away is not the same tool as dill flowering inside a tomato bed, and neither is the same as a dense stand of marigolds grown before vegetables for a diagnosed nematode problem. Washington State University Extension’s evidence review of companion planting makes the same broad point: companion planting is a legitimate horticultural practice, but popular claims often run far ahead of field evidence.

Garden problemPlant tactic worth tryingWhat it can realistically doWhat still matters
Aphids and whitefliesFlowering dill, fennel, cilantro, sweet alyssum, or selected aromatic companionsFeed or shelter natural enemies; sometimes disrupt host-findingInspect new growth and wash or remove colonies early
Caterpillars on tomatoes or brassicasDill and other insectary flowers; basil or thyme as a trial companionSupport parasitoids or reduce some egg-laying behaviorRow covers and hand-picking are more immediate
Flea beetlesVery close companion or sacrificial radish; sage or mint as a trialGive beetles another landing and feeding optionProtect small seedlings with a barrier
Carrot fly or leek mothIntercrop carrots with alliums, or alliums with carrotsBreak up a host-crop signal in some situationsUse local timing and cover the crop when pressure is high
Root-knot nematodesA dense, pre-plant marigold cover crop in the same soilSuppress certain nematodes when species and cultivar matchTest soil; do not expect a flower border to cure roots already infected
Slugs, rabbits, deer, or a severe outbreakPlants alone are a weak first choiceMay add habitat or mild frictionUse barriers, habitat changes, removal, or a labeled control

If you do not know what is eating the plant, do not buy a “repellent” plant yet. Chewed edges, stippling, sticky leaves, holes, wilt, and missing seedlings point to very different pests. A photo, a look under leaves, and a check at dusk can save more time than planting an entire border that targets the wrong insect.

How plants actually influence pests

There are three defensible mechanisms behind plant-based pest management. First, a nonhost plant can disrupt the visual search an insect uses to find a crop. Second, flowers can provide nectar, pollen, shelter, or alternative prey for beneficial insects. Third, certain plants can act as a trap crop or a pre-plant cover crop that changes what happens in the soil.

Scent is real, but the popular version of the story is too simple. Aromatic plants release volatile compounds, and laboratory tests have found some of those compounds unattractive or disruptive to insects. In an open garden, however, air movement quickly dilutes the chemicals. The WSU review notes that field research has not consistently shown that mint, rosemary, basil, or other aromatic plants create a dependable outdoor scent barrier. In some cases, the plants and their flowers can attract pests or affect beneficial insects too.

The stronger garden-scale idea is complexity. When a bed contains several plant shapes, heights, colors, flowering periods, and nonhost leaves, a specialist pest has fewer uninterrupted host plants to colonize. It may still find the crop, but the population can spread more slowly, and natural enemies have more places to feed and shelter. That is why a mixed bed with flowering plants can be more useful than a single row of one strongly scented herb at the edge.

A diverse vegetable bed with flowers and herbs mixed around food crops

This does not mean every pairing is scientifically proven or that a chart of “good neighbors” is a law of nature. West Virginia University Extension’s companion-planting guidance calls the practice a useful starting point but emphasizes that outcomes vary by region and that gardeners should record successful and failed combinations. Treat a pairing as a small, observable experiment, not a guarantee.

Match the plant tactic to the pest

Aphids and whiteflies.

Aphids and whiteflies are soft-bodied sap feeders that often gather on tender new growth. The plant response that makes the most sense here is not a magical smell; it is a steady supply of beneficial insects. Flowering dill, fennel, cilantro, sweet alyssum, yarrow, and similar plants can provide nectar for hoverflies, lacewings, lady beetles, and parasitoid wasps. Hoverfly larvae and lady beetle larvae can consume many aphids, while parasitoids use aphids or other pests as hosts for their developing young.

Keep those flowers blooming for more than one week. Penn State Extension recommends diverse plantings with something in bloom from early spring through late fall, along with shelter and shallow water. If you grow basil or marigolds beside tomatoes, treat them as supporting plants rather than the main control. Scout the undersides of leaves, and remove a heavily infested shoot before the colony spreads.

Caterpillars on tomatoes and brassicas.

For caterpillars, the useful question is whether a companion can help natural enemies find the bed or reduce egg-laying—not whether its odor will kill a caterpillar. Dill, fennel, cilantro, and sweet alyssum are valuable when allowed to flower because they provide nectar to small parasitoid wasps and other predators. Savvy Gardening’s research-based tomato companion overview also points to thyme and basil as tested partners for reducing some armyworm or hornworm egg-laying and thrips damage, while warning against reducing the explanation to scent alone.

Brassica seedlings still deserve a row cover if cabbage moths are common in your area. A flowering border may support predators later, but it cannot unlay eggs that have already been deposited on the undersides of kale or broccoli leaves. Remove the cover when the crop needs pollination, or use it on crops whose edible part does not depend on insect pollination.

Flea beetles, carrot flies, and other small crop specialists.

Small flying pests often respond to the layout of the crop more than to a plant’s reputation. Gardeners’ World’s companion-planting examples describe mint near brassicas as a possible flea-beetle distraction, alliums paired with carrots and leeks, and sage alongside brassicas. Those combinations are reasonable trials, but the placement has to be close enough to break up the host crop rather than sitting as a decorative hedge at the far end of the yard.

For a young crop, physical protection is usually more reliable. A floating row cover installed before the adult pest arrives can block egg-laying, while a companion plant added after the first generation has colonized is playing catch-up. If you use radishes or another sacrificial crop as a flea-beetle trap, expect the leaves to show damage and decide in advance whether you will remove the trap crop when it becomes crowded with insects.

Root-knot nematodes.

This is the clearest example of why “pest-repellent plant” is an incomplete label. Marigolds can help suppress some plant-parasitic nematodes, but the tactic is a pre-plant cover-crop strategy, not a few flowers scattered around tomatoes. University of Florida IFAS explains that marigold species and cultivars vary, nematode species vary, and some marigolds can host nematodes that make a problem worse.

The conditions are specific: identify the nematode if possible, choose a suitable marigold cultivar, plant densely in the same site, grow it for at least two months before the susceptible crop, and incorporate or remove it according to local guidance. The plants cannot eradicate nematodes, and interplanting a few marigolds among already susceptible crops is not the same treatment. If root galls, stunting, and repeated wilt suggest a nematode problem, a soil or nematode assay is a better first step than a larger seed order.

Plant tactics that are worth using

The best plant choices are the ones that perform a useful garden job even if the pest claim turns out to be weak. Basil is still a harvestable herb, dill still feeds beneficial insects, lavender still supports pollinators, and marigolds still provide color. Choose companions that fit the crop’s light, water, and root space so the experiment does not cost you the harvest.

Tomatoes growing with basil, flowers, and marigolds in a mixed bed

Aromatic companions can disrupt host-finding

Basil, thyme, sage, rosemary, lavender, mint, garlic, onions, and marjoram are the classic aromatic companions. Their foliage releases volatile chemicals, and their shapes and colors add nonhost surfaces to the bed. The most responsible claim is that they may disrupt or complicate host-finding for particular pests in particular layouts.

Use them as close companions or intercropped rows when the plants have similar growing needs. A rosemary hedge on the garden boundary may be useful as habitat and a windbreak, but it is not a wall that stops insects from flying over the bed. Mint is especially easy to overplant: keep it in a container or a bottomless pot sunk into the soil, and do not let runners turn a pest experiment into a weed-control problem.

Lavender and rosemary also prefer drier, leaner conditions than tomatoes, cucumbers, or basil. If you force them into an overwatered vegetable bed, they may decline before you learn anything about pests. Put the aromatic plants where their care matches the site, then judge their pest effect separately from their survival.

Insectary flowers feed the predators you want to keep

An insectary plant is chosen primarily to support beneficial insects. Dill, fennel, cilantro, sweet alyssum, yarrow, goldenrod, asters, calendula, and signet marigold are useful candidates because their flowers provide accessible nectar or pollen. The goal is not to attract every insect; it is to keep a range of predators and parasitoids present before a pest outbreak reaches its peak.

Let some herbs flower instead of harvesting every stem. Stagger sowing so one plant does not bloom and disappear all at once, and include flowers with different shapes for different mouthparts. Maintain a shallow water source with stones or rough landing spots, and avoid keeping the soil constantly bare and overheated around the flowers. The Penn State beneficial-insect guide notes that adult beneficials often rely heavily on pollen and nectar, while permanent plantings can provide overwintering habitat.

Do not confuse pollinators with pest predators. Bees can improve fruit set, but they are not going to eat aphids. A flower may support both groups, yet the management benefit depends on whether the flowers are visited by hoverflies, lacewings, lady beetles, predatory bugs, or parasitoid wasps as well as bees and butterflies.

Trap crops move damage instead of erasing it

A trap crop is planted to draw a target pest away from the crop you value. It is a deliberate sacrifice. Examples include radishes for flea beetles around young tomatoes, collards for harlequin bugs, cowpeas for southern green stink bugs, and calendula or nasturtium for some aphids. Savvy Gardening’s tomato examples emphasize that trap crops work only when the pest actually prefers the sacrificial plant and when the trap is close enough to matter.

Place the trap where you can inspect it easily, and plant it early enough to be attractive when the target pest arrives. A trap crop that is ignored can become a breeding nursery. Check it on the same schedule as the main crop, remove or treat it according to your local rules, and abandon the tactic if it increases pest numbers in the bed. Never use a trap crop for a pest that moves freely across the entire garden without adding a barrier or removal plan.

Diversity and intercropping make the bed harder to colonize

Intercropping means growing different crops together or in alternating rows rather than planting one large, uninterrupted block. It can make the host harder to locate, reduce the speed at which a pest moves from plant to plant, improve habitat for natural enemies, and use vertical and horizontal space more efficiently. It also introduces competition, shading, irrigation conflicts, and extra harvesting complexity.

Mix crops with different root depths and mature heights, but leave enough air space for the crop to dry after rain. Use a low-growing companion where it will not smother seedlings, and keep vigorous plants such as mint, fennel, or vining nasturtium from burying a slower crop. Diversity works best when it is designed around the plants’ actual needs, not when every available gap is filled.

How to build a plant-based pest plan

A workable plan can be small. One 4-by-8-foot bed with a tomato, basil, dill, and sweet alyssum is a better experiment than six unrelated “repellent” plants scattered around the property. Build the plan in four steps so you can tell what helped.

Identify the pest before choosing a plant

Start with the damage pattern, not the plant name on a nursery tag. Look at leaf undersides, growing tips, stems, soil surface, and the plant at night. Aphids cluster; whiteflies flutter when disturbed; flea beetles leave small shot holes; caterpillars leave frass and ragged chewing; spider mites create stippling and fine webbing; slugs leave slime and irregular night damage.

If the symptom could be drought, disease, herbicide drift, or root damage, pause before adding a pest plant. A companion cannot fix a root problem that only looks like insect injury. When identification is uncertain, use a local extension office, a regional diagnostic service, or a clear close-up photograph rather than relying on a generic “bugs hate this” list.

Assign one job to each companion

Write down what you want the companion to do. “Attract parasitoids” points you toward flowering dill or sweet alyssum. “Sacrifice leaves to flea beetles” points you toward a trap crop. “Break up a brassica row” points you toward a compatible intercrop. “Suppress root-knot nematodes” points you toward a tested pre-plant marigold cover crop, not a marigold border.

If a plant has no useful job beyond an unverified scent claim, give it a low-cost trial rather than redesigning the whole garden around it. A plant that supplies food, shade, mulch, harvest, or beauty even when pest pressure is low is a safer choice.

Place companions where they can affect the crop

The distance rule depends on the job. Intercropped leaves and alternating rows can disrupt host-finding; a distant perimeter may not. Insectary flowers need to be near enough for beneficial insects to use while leaving the crop accessible for scouting. Trap crops must be close enough to attract the target but far enough that you can remove them without brushing the pest into the main crop.

Match water and light before matching scents. Put lavender, rosemary, and thyme in a sunny, well-drained position; keep basil and dill where they can receive regular moisture; contain mint; and avoid a dense companion canopy that traps humidity around tomatoes or cucumbers. Good horticulture is part of pest management because stressed plants are harder to monitor and often more vulnerable.

Monitor, record, and change one variable at a time

Inspect weekly, and inspect more often when seedlings are vulnerable or a known pest is active. Record the date, crop stage, pest count or damage level, companion plant size, weather, and whether barriers or sprays were used. A simple comparison between one mixed row and one similar row without the companion can reveal more than memory can.

Give perennial flowers time to establish, but do not wait a year for a failing annual crop. WSU Extension notes that perennial companion plantings may take a year or two to reach their best effect, while annual companions can provide resources more quickly. If the crop is being damaged now, add an immediate barrier or removal step while the plant-based system develops.

What to do when plants are not enough

When the pest is already established, move through an IPM sequence instead of adding more plants at random. First confirm the pest and estimate whether the damage threatens the plant or harvest. Then remove egg clusters, hand-pick larger pests, prune a heavily infested shoot, rinse a small colony where appropriate, or use a row cover before the next generation arrives.

Correct cultural conditions next. Thin overcrowded growth, water the root zone rather than keeping foliage wet overnight, remove diseased debris, rotate crops when practical, control weeds that can host the pest, and keep ripe or fallen fruit from feeding a new generation. For mosquitoes, eliminate standing water; no border of basil or lavender compensates for a neglected bucket, saucer, gutter, or rain-filled toy.

If a treatment is necessary, use a product labeled for the crop and pest, follow the current label, and choose the least disruptive option that fits the situation. “Natural” does not automatically mean harmless to bees, aquatic life, pets, or beneficial insects. Penn State Extension cautions that many beneficial insects are more sensitive to insecticides than the pests gardeners are trying to control, so broad, repeated spraying can undo the habitat you planted.

Common mistakes that make pest-repellent planting disappoint

The first mistake is expecting a scent wall. In a breezy garden, volatile compounds do not remain at a uniform concentration around every leaf. The second is using a plant for the wrong pest: marigolds may be associated with aphids, nematodes, and pollinators, but that does not make them a treatment for squash bugs or cabbage worms.

Another mistake is planting too few flowers or harvesting them before they bloom. A single basil plant may add flavor, but it cannot support a season-long beneficial-insect community. On the other hand, a dense mass of a single aromatic plant can compete with the crop, harbor unwanted pests, or make scouting harder.

Trap crops fail when the gardener forgets that the trap is supposed to be attractive. If you do not inspect and manage it, you may simply increase the pest population next to the crop you hoped to protect. Likewise, a marigold planted between tomato plants is not the same as the dense, same-site, pre-plant cover-crop sequence used for certain nematodes.

Finally, do not copy a companion chart without checking climate, mature size, invasiveness, and water needs. Gardeners’ World notes that mint is best grown in a pot because it can smother nearby crops. A plant that takes over the bed is not a successful pest-control system, even if its leaves smell strong.

A realistic three-bed example

Imagine a small vegetable garden with three beds and recurring summer pest pressure. In the tomato bed, plant basil and thyme where they will not crowd the stems, allow a few dill or cilantro plants to flower, and add sweet alyssum along the edge. The goal is a mix of harvestable herbs, nonhost foliage, and nectar for beneficial insects—not a promise that hornworms will never appear.

In the brassica bed, place sage or contained mint where it will not shade seedlings, add a flowering insectary nearby, and use a row cover while cabbage plants are small. Inspect the cover and leaf undersides every week. If flea beetles are the main problem, test a close sacrificial planting such as radish, but remove the trap if it becomes a dense, unmanaged source of adults.

In the root bed, try a carrot-and-leek or carrot-and-garlic layout if both crops fit the season and soil. Record whether carrot-fly damage changes compared with last year, and protect the crop if local pressure is high. If the site has a documented root-knot nematode problem, reserve a season or part of a rotation for the appropriate marigold cover-crop method instead of assuming that a few flowering plants will protect the roots.

Nasturtiums used as a visible trap-crop companion around a vegetable bed

That three-bed plan is modest on purpose. It gives each companion a job, keeps the crop accessible for scouting, and leaves room for barriers and rotation. If the plants do not reduce damage after a fair trial, you have not lost the whole garden—and you have useful observations for the next season.

Safety, competition, and coexistence

Use correctly identified plants, especially when leaves or flowers will be eaten. An ornamental “marigold” or scented geranium is not automatically a culinary herb, and a plant that is safe for people is not necessarily safe for pets. Keep seed packets and labeled treatments away from children and animals, and ask a local extension service about plants that are invasive or restricted in your region.

The garden also has to work as a plant community. Give tall companions enough spacing that they do not shade sun-loving vegetables, group plants with similar watering needs, and avoid aggressive perennials in small beds. Remove diseased foliage and do not let a trap crop become a seed source or a pest nursery.

Leave some insects alone. A few chewed leaves can be the cost of hosting birds, parasitoids, and pollinators, and a healthy plant can tolerate minor damage. The goal is to keep pest numbers below the level where the crop, harvest, or plant health is threatened. That is a more durable goal than trying to sterilize the garden of every six-legged visitor.

Conclusion

Plants can deter garden pests, but they work best as supporting infrastructure, not as a stand-alone shield. Aromatic herbs may complicate host-finding, mixed plantings can slow colonization, insectary flowers can keep natural enemies in the garden, and trap crops can redirect damage when they are monitored. Marigolds have a particularly useful but narrow role in managing certain nematodes under specific pre-plant conditions.

Start with the pest, choose one plant-based job, place the companion close enough to matter, and keep a record. Add row covers, hand removal, sanitation, crop rotation, or a carefully chosen labeled treatment when the crop needs more protection. That combination is what gardeners can actually use: fewer exaggerated promises, more resilient beds, and a practical response when the plants alone are not enough.

Frequently asked questions

Can plants alone keep garden pests away?

Usually not. Plants can lower pest pressure by disrupting host-finding, supporting predators and parasitoids, or acting as a trap crop, but they rarely stop an established infestation. Identify the pest first, choose a plant with a specific job, and keep row covers, hand-picking, sanitation, and other IPM steps available when damage continues.

Do marigolds really repel garden bugs?

Not broadly. Marigolds are useful flowers and can support beneficial insects, but field evidence does not support the idea that they repel every garden pest. Their strongest evidence-backed use is as a dense, same-site, pre-plant cover crop for suppressing certain plant-parasitic nematodes, and the result depends on the marigold cultivar, nematode species, soil, and timing.

Which plant attracts insects that eat aphids?

Let dill, fennel, cilantro, sweet alyssum, yarrow, calendula, and other accessible-flowered plants bloom. Their nectar and pollen can support hoverflies, lacewings, lady beetles, and parasitoid wasps. Plant a succession of flowers, avoid broad-spectrum sprays when possible, and inspect the crop before treating because beneficial larvae are easy to mistake for pests.

Can basil protect tomato plants from pests?

Basil may help as one companion in a diverse tomato bed, and research-based gardening guidance associates tomato-basil interplanting with reduced egg-laying by some pests and less thrips damage. Do not treat it as a guarantee or a substitute for inspecting tomato leaves, hand-picking hornworms, using a barrier for seedlings, or responding to a confirmed outbreak.

What is the best way to use a trap crop at home?

Choose a sacrificial plant the target pest demonstrably prefers, plant it early and close enough to draw the pest, then inspect it on the same schedule as the crop you value. Examples include radish for some flea beetles, collards for harlequin bugs, and calendula or nasturtium for some aphids. Remove or manage the trap before it becomes an unmanaged breeding site, and stop using it if pest numbers rise in the main crop.

How the "Plants That Deter Garden Pests: A Practical Guide" guide is reviewed?

Editorial policyReview board

Written by · Reviewed by LeafyPixels Review Board · Updated September 12, 2026

This "Plants That Deter Garden Pests: A Practical Guide" guide was researched and written by . Recommendations in the "Plants That Deter Garden Pests: A Practical Guide" guide are checked against multiple independent references before publication.

We prioritize sources that hold up under scrutiny:

  • University cooperative extension bulletins and fact sheets (Penn State, Clemson, UMD, NC State, and similar programs)
  • Botanical garden and horticultural society publications
  • Peer-reviewed plant science and veterinary toxicology references where pet safety matters (including ASPCA Animal Poison Control)
  • Established reference works on indoor plant culture

The LeafyPixels editorial team then reviews the draft for clarity, step-by-step usefulness, and fit with real apartment and home conditions-not ideal greenhouse setups. When guidance changes materially, we update the page and note the revision date.


Sources used

  1. Gardeners’ World’s companion-planting examples (n.d.) 10 Companion Plants To Grow. [Online]. Available at: https://www.gardenersworld.com/plants/10-companion-plants-to-grow/ (Accessed: 12 September 2026).
  2. Penn State Extension recommends diverse plantings with something in bloom from early spring through late fall (n.d.) Attracting Beneficial Insects. [Online]. Available at: https://extension.psu.edu/attracting-beneficial-insects (Accessed: 12 September 2026).
  3. Savvy Gardening’s research-based tomato companion overview (n.d.) Tomato Companion Plants. [Online]. Available at: https://savvygardening.com/tomato-companion-plants/ (Accessed: 12 September 2026).
  4. University of Florida IFAS explains (n.d.) NG045. [Online]. Available at: https://edis.ifas.ufl.edu/publication/NG045 (Accessed: 12 September 2026).
  5. Washington State University Extension’s evidence review of companion planting (n.d.) Gardening With Companion Plants Home Garden Series. [Online]. Available at: https://pubs.extension.wsu.edu/product/gardening-with-companion-plants-home-garden-series/ (Accessed: 12 September 2026).
  6. West Virginia University Extension’s companion-planting guidance (n.d.) Companion Planting. [Online]. Available at: https://extension.wvu.edu/lawn-gardening-pests/gardening/garden-management/companion-planting (Accessed: 12 September 2026).