There's a lot to like about ants: They work together, they eat other pests, and they made pretty adorable stars in A Bug's Life. Some people even keep them as pets! But when there's an infestation crawling all over your pantry? Not so great. Ants can also contaminate your countertops with E. coli or salmonella if they've walked through garbage or waste along their route. (Yuck.)

Here's how to curb the onslaught of pests — for good:

1. Figure out what kind of ants you have.

While there are thousands of species of ants, only about 25 of those commonly make their way into American homes, according to Mike Goldstein, a Certified Pesticide Applicator for Woodstream. The most pervasive of these include pavement ants, Argentine ants, odorous house ants and carpenter ants. Identifying the particular kind is key, because it'll help you figure out what they're eating and where they're coming from.

Tiny, brown or black pavement ants usually come inside from their nest outdoors. Argentine ants are also small and brown, but they often live indoors near food and moisture, like potted plants, sinks, and pipes. Odorous ants earn the name because they stink like rotten coconut when you squish them.

As for carpenter ants, they're not your friends. They literally destroy your house from the inside out by tunneling through the wood, especially where it's damp. Look for large, black ants as well as the tell-tell sawdust-like debris, called frass. It's a delightful mix of chewed wood, feces, and dead ants.

If your pest doesn't match any of those descriptions, try contacting your local cooperative extension agent or an exterminator for more info on what's common in your area.

2. Seal up cracks and openings.

Yes, ants are tiny, but it's still a good idea to seal off crevices with clear caulk or steel wool, especially if you spy an obvious trail marchin' on in. Patching torn screens and replacing worn door sweeps can also make a big impact.

3. Remove all potential food sources.

Ants eat like humans, enjoying sweets, proteins, and fats, but it's not just people food you should look for. In addition to sealing up groceries in airtight containers and cleaning up crumbs and spilled drinks quickly, consider some other popular items on the ant menu: grease splatter around the kitchen, oils spills, or even other insects — including dead ones — lying around. These suckers are resourceful!

4. Put out bait.

The temptation is to squash every ant you see, but that's not going to cut it. "Only about 10% of the ants in the colony are outside foraging at a time, which means 90% of that colony is hidden away," Orkin entomologist Chelle Hartzer explains. "You may kill a couple random ants, but that still leaves a lot back in the nest to fill in that void."

To address the problem at its source, you're better off trying a bait trap. "Ants will carry the bait back to the colony, share the bait and then it gets dispersed and kills off the colony," Goldstein says. Even better, more ants will follow pheromones back to the trap, speeding along the process. Just be careful that you don't spray any pesticide on the bait or trail of ants, since it'll interfere with the chain reaction.

A bait trap we like: Terro Liquid Ant Bait ($10 for 2, amazon.com), which is a top pick on Amazon with 6,000-plus reviews and a four-and-a-half star rating.

terro liquid ant baitBUY NOW
Terro

We also recommend this DIY method:

  • Mix 1 tablespoon of boric acid powder ($13 for 1 pound, amazon.com) with 1 1/4 cups sugar. (The sugar attracts the bugs — remember they have a sweet tooth!)
  • Sprinkle in areas where you see lots of ants, such as the backs of cabinets and under the sink.

SAFETY ALERT: Keep the powder away from kids or areas your pets can access as it's toxic when ingested in large amounts.

5. If the above isn't working, call in a professional.

Sometimes, you need to bring in the pros. "They can trace it back to the colony where they're originating from and eliminate most of the problem, if not all of it," Hartzer says. An expert is also a good idea when it comes to carpenter ants, because they can cause serious and potentially dangerous structural damage.

WATCH: 3 Homemade Fruit Fly Traps That Actually Work

preview for These DIY Fruit Fly Traps Will Save Your Kitchen
Headshot of Caroline Picard
Caroline Picard
Contributing Writer

Caroline is a writer and editor with almost a decade of experience. From 2015 to 2019, she held various editorial positions at Good Housekeeping, including as health editor, covering nutrition, fitness, wellness, and other lifestyle news. She's a graduate of the Medill School of Journalism and dreams of the day Northwestern will go back to the Rose Bowl.