Coffee grounds do appear to repel ants, and there’s some experimental evidence to back it up. In a controlled test comparing seven common household products as ant barriers, coffee grounds performed best, keeping all ants away from a food source over a five-hour observation period. The effect likely comes from the strong volatile compounds in coffee grounds, which overwhelm the scent trails ants rely on to navigate and communicate.
What the Evidence Shows
A study published in Instars: A Journal of Student Research tested coffee grounds head-to-head against baking soda, black pepper, vinegar, mustard, bleach, and crushed bay leaves. Researchers placed honey in the center of separate containers, surrounded each with a ring of one product, then introduced ten harvester ants to the outside of each barrier. After five hours, coffee grounds were the only product that kept every single ant away from the honey.
That’s a promising result, but it comes with caveats. The test used a small, enclosed container with a limited number of ants and a single food source. In the real world, ants encounter coffee grounds differently. They can go around barriers, dig underneath them, or simply wait until the scent fades. Outdoors, rain, wind, and sun break down coffee grounds faster than in a lab setting, reducing whatever repellent effect they have.
How to Use Coffee Grounds Against Ants
If you want to try coffee grounds as an ant deterrent, the approach is straightforward. Spread a thick line of used grounds along the entry points where ants are getting in: doorways, windowsills, foundation cracks, or the edges of garden beds. The grounds need to form an unbroken barrier, since ants will find and exploit any gap. Fresh, still-damp grounds have a stronger scent than dried-out ones, so replace them every few days or after rain.
Some people also scatter grounds directly on ant trails in the garden or around plant bases. This can disrupt the chemical trails ants leave for each other, temporarily confusing foragers. But “temporarily” is the key word. Once the coffee smell fades, the ants will likely return unless you’ve addressed whatever attracted them in the first place.
Limitations as a Long-Term Solution
Coffee grounds work more as a short-term disruption than a permanent fix. They don’t kill ants or destroy colonies. The queen continues laying eggs underground regardless of what’s happening on the surface. For a serious ant problem, especially carpenter ants or fire ants, coffee grounds alone won’t solve it. They’re better suited as one layer of defense: useful for redirecting a minor trail away from your kitchen or protecting a specific plant, but not a replacement for addressing the colony itself.
The repellent effect also depends on the type of ant. The study tested harvester ants specifically. Different species vary in their sensitivity to scent-based deterrents, and some of the more persistent household invaders (like Argentine ants or odorous house ants) may be less easily discouraged.
Watch the Amount in Garden Soil
If you’re spreading coffee grounds around outdoor plants to keep ants away, it’s worth knowing how they affect your soil. Brewed coffee grounds are close to neutral in pH, typically landing around 6.5 to 6.8, so the common belief that they acidify soil is mostly a myth. Any pH shift is temporary and too small to meaningfully help acid-loving plants like blueberries or azaleas.
The bigger concern is nitrogen. As soil microorganisms break down coffee grounds, they temporarily lock up nitrogen in the soil, which can slow plant growth or inhibit seed germination. Caffeine residues in the grounds can compound this effect. Oregon State University Extension recommends adding a nitrogen-rich source like composted manure, alfalfa meal, or grass clippings alongside the grounds to offset this. If you’re composting them instead, keep coffee grounds to no more than 20% of the pile’s total volume. Higher concentrations can become toxic to plants.
Used in moderation, coffee grounds improve soil structure over time. Microbes feeding on the grounds release compounds that help soil particles clump into stable, well-draining aggregates. You may notice mold developing on the surface, which looks unpleasant but is harmless and actually helps decomposition. The trouble comes from overdoing it. Thick, compacted layers of grounds can form a water-resistant mat, and excess application has been known to ruin raised beds entirely.
Getting the Most Out of Coffee Grounds
For the best results as an ant deterrent, think of coffee grounds as a free, low-effort first step rather than a complete solution. Use them to block specific entry points and disrupt active trails. Refresh them every two to three days to maintain scent strength. Pair them with basic ant prevention: seal food containers, clean up crumbs and sticky residues, fix moisture problems, and eliminate standing water near your home’s foundation.
If ants keep returning despite your efforts, the colony is likely close enough that surface-level deterrents won’t cut it. At that point, bait-based approaches tend to be more effective because foragers carry the bait back to the colony, targeting the queen and the rest of the nest rather than just the visible workers on the surface.