The most effective way to control an ant infestation is to find the nest and destroy colony inside it, including the queens. While this isn't always practical, especially if the infestation is outdoors, there are strategies that make it easier. One is to spread honey or some other delicacy at the point of the ant infestation and observe the line of ants that accept the food and take it back to the nest. The line will terminate at the nest, and once its location has been determined, the colony can be exterminated by drenching the area around it with an insecticide. If an infestation of household ants leads to a crevice in a wall or under the floor, the colony can usually be destroyed by spraying the wood around it.
There are many species of ants, and some are beneficial, so spraying the entire yard or spreading granules to exterminate an unwanted colony isn't usually recommended and is seldom effective. Moreover, spraying the ants in the area where the infestation was first noticed may provide temporary relief, but it is unlikely to be effective in the long term. Those ants likely represent a small part of the colony. The line will simply change direction to avoid the sprayed area, and the ant infestation will continue in another part of the house or property.
Baiting ants with poison is another effective way to get rid of ants. The advantage of this method is that it the ants will take the poison back to the nest and feed it to the colony members there, including the queens, making finding the location of the nest unnecessary. There are many baits available at grocery and hardware stores, and they can be placed wherever the ant infestation has become apparent. It is not recommended to spray ants in the vicinity of the bait, because the spray will deter other ants from coming around it.
An indoor ant infestation can be prevented by sealing around baseboards, door thresholds, windows, and the openings where utility pipes and wires enter the home with caulk. A special effort should be made to seal cracks or other openings where ants are observed entering from outside. In addition, spraying insecticide around the perimeter of the house acts as a further deterrent to ants, and should be done at regular intervals. To effectively prevent an ant infestation, the insecticide should be sprayed on the ground in a 2 to 6-foot (0.6 to 1.82-meter) band around the foundation as well as on the foundation wall.