How to get rid of ants – in your backyard and indoors

Find out how to get rid of ants that are invading your home and outdoor space with our expert guide

ants on sugar
(Image credit: roberto hunger / Alamy Stock Photo)

If they’re on the march in your backyard, and making their way into your home, you’ll likely be asking how to get rid of ants. Often they’re simply a nuisance, but some can cause structural damage while others could sting.

Ants generally build nests outside, but food and moisture can attract them inside, making tackling these insects necessary. The good news is that proven cleaning tips can keep them at bay, along with common pantry staples, while commercial products can eradicate them.

We’ve got the lowdown on how to get rid of ants here, plus the experts’ guidance on keeping your home ant-free. 

4 ways to get rid of ants

Ants are very common, and like fruit flies and gnats, are likely to be a nuisance in summer. ‘In nature, ants usually nest in many areas including under mulch, under stones, in log piles, under concrete slabs and even in trees and bushes,’ says Eric Benson Ph.D., an extension entomologist with Clemson University cooperative extension. 

‘Some ant colonies can have many nests at one time with many queens. Colonies can be huge, numbering into millions of workers. Other colonies can be small, but if the small colonies are in numerous locations, they can also be a challenge to control if they become a pest.’

Water and a wide variety of food attract ants into the house, too. Luckily, there are plenty of options for getting rid of them.

ants in kitchen

Ants are a common pest both indoors and out

(Image credit: DZM / iStock / Getty Images Plus / Getty Images)

1. Remove food sources

If you’ve had an invasion of ants, put off any return visits by cutting off their food supply, both outdoors and in. This means tidying up after al fresco dining and sealing food away indoors. 

‘Close all food containers and regularly clean the cabinet and pantry shelves,’ recommends Alice Sinia, Ph.D., a quality assurance manager of regulatory/lab services for Orkin Canada who performs analytical entomology and technical support in pest and insect identification. ‘Then, wipe all countertops regularly, and vacuum and mop the floors regularly to clean up any food crumbs and stains.’

Make sure to shut trash cans tightly and, once pets have eaten, pick up the bowls immediately and rinse them out. 

Think about water sources as well as food. ‘Correct any moisture problems inside and outside the home,’ says Eric Benson.

ants around jam

Clean up food spills promptly to deter these pests

(Image credit: Hakan Soderholm / Alamy Stock Photo)

2. Stop them from entering

As well as taking away the food and water ants are seeking, pay attention to where they are coming into your yard or home. ‘Ants are more likely to enter the home if you have potential entry points such as cracks and crevices in walls or in your home’s foundation,’ says Alice Sinia. 

‘Seal any cracks or holes using caulk to prevent more ants from invading the home. During the summer, trim tree branches or shrubs that may be touching your house, as unmaintained trees and shrubs provide the ideal bridge for ants to get into your home.’

3. Use pantry ingredients for DIY solutions

Ants use pheromones to follow each other along a route, so a natural way to get rid of them is to disrupt them with scent. Fill a spray bottle with a mix of one part vinegar to one part water and use it to spritz surfaces. The strong scent of lemon will also repel them, or try tea tree oil sprinkled onto cotton wool balls and placed in their pathway. Another option to try is spray-on glass cleaner mixed with liquid detergent. 

‘Black pepper or cayenne pepper deters ants,’ says Megan Wede, the co-owner of Done Right Pest Solutions. ‘Even if you use it as a barrier around your home, the ants won’t cross over the line of pepper.' That said, it will blow or wash away in windy and rainy weather, but you could try it inside your home, she adds. 'Cinnamon deters ants as well and it smells better to us.’

You may have heard that using peppermint oil to get rid of mice is effective, but this scent is powerful against ants too. You can spray this strong-smelling aroma around your home (when mixed with water) or fill a diffuser to keep the pest at bay.

Cut lemons on chopping board

The smell of lemon is said to repel ants

(Image credit: Future)

4. Get rid of ants with ant bait

Ant bait looks like a banquet to all unsuspecting foraging ants such as red ants and flying ants, as well as your regular garden ant. ‘Follow the trail to identify the entry point, or place ant bait along the trail,’ says Thomas Marbut, corporate trainer and general manager at Mosquito Squad. ‘Ant bait is available at most grocery or hardware stores and functions as bait that the ants carry back to the colony, which then poisons the ants and reduces the population.’

You might have to repeat the process once a week to get results. Keep this out of the way of kids and pets. A safe route is to choose a pre-baited pack of gel, which you can place at a strategic point, ensuring that no one touches the bait within. 

If you’re comfortable with using chemical insecticides around the house, sprays and aerosols can zap ants wherever you see them crawling around. Chemical ant killers also come in powder form, in a puffer pack. 

Natural solutions made from plant extracts are also available, such as this one from Amazon.

How to deal with ants in your backyard

Ants get a bad press, but as part of the eco-system they have benefits for the garden. Their nests aerate the soil, and they make a tasty snack for birds and other insects. Unless they’re causing a nuisance, it’s best to leave them be.

‘There are hundreds of species of ants in North America,’ explains Eric Benson of the Clemson University cooperative extension. ‘Most ants are beneficial in the environment. In fact, many native ant species help control pest ants that try to establish in yards and invade homes. If possible, don’t use broad-spectrum insecticide sprays in the yard that kills all insects, including beneficial ants. If you kill beneficial ants, eventually new ants will move back into the yard and the new ants are likely to be pest ants.’

On the downside, ants can disturb plant roots while digging out their colonies and form ant hills on lawns. You can simply brush these away or break them up with a fork and treat with an insecticide or organic powder. Keep aphids under control, as ants farm these for the honeydew they produce. Ants exploring walls or window frames can be deterred by soapy water, but avoid this on decking or steps as it can make them slippery.

Though it sounds like the stuff of horror movies, pouring a kettle of boiling water over an ants nest will instantly kill any you can see. The colonies can run deep and you may not catch all the ants this way, though. A bait trap could be a solution here. For a nuisance nest that’s too close to a building or inside the wall voids, you may have to call in a professional pest control company. 

Tiny parasitic creatures called nematodes could also solve the ant nest problem. A pack usually contains millions of nematodes that won’t harm children, pets or wildlife. It should be applied when the soil temperature is above 50ºF. Just mix with water and pour onto the nests.

ants on leaf

If possible, ants outdoors are best left undisturbed

(Image credit: All Canada Photos / Alamy Stock Photo)

Does diatomaceous earth kill ants?

Diatomaceous earth, available from Amazon, is a natural and non-toxic alternative to chemicals, and is useful for getting rid of some types of ants. It's made up of fossilized diatoms, a type of microscopic algae. If ants walk through the powder, it sticks to their exoskeletons. Because the particles are sharp, they damage the exoskeletons, leading the pests to die of dehydration.

It can work well when put around entry points. Follow the packet instructions to apply, and be ready to reapply outdoors after heavy rainfall. It can also help get rid of many other pests, including cockroaches and fleas, but bear in mind that it can also harm beneficial pollinators. Because of this, avoid placing it close to your garden flower beds.

Lola Houlton
News writer

Lola Houlton is a news writer for Homes & Gardens. She has been writing content for Future PLC for the past five years, in particular Homes & Gardens, Real Homes and GardeningEtc. She writes on a broad range of subjects, including recipe articles, reviewing products, writing ‘how to’ and ‘when to’ articles. Lola now writes about everything from organization through to house plants. Lola is a graduate student, who completed her degree in Psychology at the University of Sussex. She has also spent some time working at the BBC.

With contributions from