What's the best way to gets ants out of a laptop?

  • That question reminds of the good old times, when computers had the size of buildings. Maybe you should ask some computer pioneers how they got rid of bugs! americanhistory.si.edu/collections/…
    – Darokthar
    Mar 12, 2011 at 16:43
  • 12
    Take a trip around Central and South America with your laptop until you find an anteater that will willingly do the job for you. It may take a while to find one, but you'll have an amazing holiday!
    – onestop
    Mar 12, 2011 at 20:44
  • 2
    just gotta say, this is one interesting question. Fire away! :)
    – studiohack
    Mar 13, 2011 at 0:29
  • 21
    That's another way of debugging your computer. Sorry, couldn't resist.
    – jokoon
    Mar 13, 2011 at 1:28
  • 9
    Insert an ant-eater into the USB port. That'll soon get rid of 'em.
    – alexia
    Mar 13, 2011 at 13:08

13 Answers 13


First determine the species of ant. It can't be soldier ants or driver ants for example since these are nomadic. Likewise, weaver ants make nests from the leaves in trees and so are unlikely to have occupied a laptop keyboard. Pharaoh ants are a likely candidate, being small (2mm) and common in human buildings. If they're yellow crazy ants then be careful of touching your eyes with your fingers as formic acid can cause blindness.

Ants' compound eyes have specialised cells that can detect polarized light, so it is possible that the ants have become disoriented by the polarized light from your laptop screen. You could counteract this by using an external CRT monitor for a while, until the ants have moved on.

If it's an established nest the queen may have constructed a sizeable brood chamber, which is likely to be situated under the space bar or the enter key. Pharaoh ants have more than one queen though (unlike the popular image of a single queen), so the caps lock and backspace keys might also be concealing chambers, be sure to check those.

Foraging ants travel up to 200m from the nest, often navigating by counting the number of steps they have taken. An improvised small scale treadmill (moving a piece of paper) will often be sufficient to confuse them sufficiently to persuade them to move on, or to induce an ant mill.

Tease them out with bait. They're very fond of chopped liver.

  • 10
    Freakin' brilliant answer, +1
    – nhinkle
    Mar 13, 2011 at 0:59
  • Very detailed answer (one could discuss whether that's necessary, but hey). +1 (can't give more, sorry)
    – Franz
    Mar 13, 2011 at 19:04
  • 1
    From my observations the ants are there for the silicone based rubber underneath the keyboard. Its definitely not behind the light as ants are seen even in laptops that do not have a keyboard back-light.This eating up will eventually lead to the loss of the spring back action of keys and consequently compel us to go for a keyboard replacement. Lets hope the manufacturers find a countermeasure to keep ants away.
    – iSeeker
    May 30, 2015 at 6:52
  • @iSeeker is correct, I've also seen ants eat (and destroy) rubber domes under a clean/barely used keyboard. Feb 11, 2016 at 5:40
  • @iSeeker might be right in some cases, but there's a lot of different sorts of ants around the world, with quite different dietary preferences. For the time being I'll stick with the assumption that they're likely to prefer all the crumbs and dead flakes of skin that have accumulated in my years-old laptop.
    – mc0e
    Mar 4, 2016 at 3:33

Don't drop food or drink on your laptop. A vacuum would probably be a great way to get crumbs out, but you might need to call an exterminator like Orkin to get it handled professionally. =P

Seriously though, you'll need to open up your laptop and vacuum out the crumbs; in the future, don't eat food over your keyboard -- crumbs drop in, the food goes bad, and then the scouting ants will detect it and find it. After the scouts return to the nest with the good news of the newly discovered food source, they'll send in the army.

Okay, everybody sing with us now ... the ants come marching in...

  • This isn't good enough. I just had an ant infestation in a keyboard that is kept clean and has barely been used for years. They were actually eating the rubber domes under the keys (I removed the key caps and watched them do it). The keyboard is ruined now, some of the rubber domes destroyed. Feb 11, 2016 at 5:39

Depending on how bad the infestation is one of these techniques may work for you:

  • Vacuum cleaner

    If there are just a few ants hidden in and around the keys a vacuum cleaner may well be able to suck them out. It is sometimes a good idea to stretch a cut-off section of an old pair of nylon stockings over the end of the vacuum tube to prevent any loose keys from getting sucked up into the vacuum bag.

  • Dismantle and clean

    If the infestation is quite bad you will have to dismantle the laptop and clean it thoroughly. A soft paintbrush can be used to coax the ants out of corners and from in between IC pins etc. Take care when doing this to keep track of all the screws and components, and wear an anti-static wrist strap at all times.


Are we talking about ant corpses or living ants? If they are alive, you could always put some food next to your hi-tech ant colony and wait for the ants to go outside to get it. Then you could move your laptop into an ant-free environment.

Or you could just keep using laptop and wait until it hets hot enough for the ants to leave. Unless it's winter and they love it and stay there until they finish up all the food leftovers you've been forgetting to get rid of.

Or just get a spider and watch the show as the fight it for survival. Although don't count on that, since they live in the laptop they might get some tech from it and build powered robot-ant suits to keep spiders away.

  • Maybe run a full burnin suite to get it extra toasty.
    – Journeyman Geek
    Mar 24, 2011 at 0:53
  • Spiders might like the smell! Nobody likes spiders around the keyboard they'll type gibberish and get you into trouble from misunderstandings!
    – enon
    Mar 24, 2011 at 1:03
  • 1
    @overmann Obligatory XKCD: xkcd.com/1530 (You psychic weirdo you.) May 27, 2015 at 13:33

I would first kill them by putting Boric acid (Borax) around the keyboard for a few days, or you could put something sweet (icing sugar) in a small plate near by and surround that with the Boric acid. If you use sugar, keep it dry and just mix the boric acid in with it. This also works for cockroaches. It is better if you have a small amount of nearby water near also. Then shake and vacuum. If you don't kill them, the infestation will probably continue.


Assuming the ants are dead, you might be able to get them out with something like this - I refer to it as gunk, tho other call it snot. However in this PARTICULAR case, while the stuff's reusable i'd suggest throwing it out once your done.

just pat the keyboard, and watch the ants stick to it.

I also suspect canned air (which isn't really air) might be a good option -its really a hydrocarbon, so will, alongside blowing out the little critter, have some chance of freezing or killing them.


I was totally confused and disturbed when I saw ants climbing out of my lappy, they were there everywhere, coming out of keyboards, screen. It is quite irratating. I used a trap of icing sugar and kept it near the laptop, in a while I had them out and remembered bot to leave any food crumbs on my laptop ever again. To be sure I kept the laptop in the sun for a while and coming from a country like India, it could get wuite scorchy and thats about it. You can try it, It works.


Whenever someone comes out for their regular roaming, brush them away.... If it's the laptop, you might find some often under the laptop. So do a regular lift every hour or half and brush them away.... And they will automatically come out due to prolonged use when your laptop gets heated... SO whoever comes out, brush (please don't crush them) him away


If you have the time, or don't mind using the laptop for a while. You can just seal the laptop in a ziploc bag or with plastic wrap for a couple of days. The lack of food and/or oxygen will kill them off. I suggest you take off the battery but it should be fine leaving it there.

This might mean you'll have dead ants left in your laptop after shaking the rest off, but at least they wont be bothering you again - unless they're the type that haunts people from the grave.


Get an empty box, get an insecticide spray and a laptop containing ants. Put the laptop in the box and spray with the insecticide spray around the laptop. Quickly cover the box for it to work effectively. Open about 30 minutes time and all the ants in it will die. after all these u can spray with a perfume around the laptop, maybe yo might not like the scent of the insecticide spray.


vacuum cleaner & a blower, it usually cleans both the ants and the crumbs


What i do is put some sugar near my laptop on the table to attract ants from the lap top. Then I draw lines around sugar using cocroach killing chalks. It will kill them all. Kinda weird but it works.


You could put the laptop on some sort of island surrounded by water. Eg on top of an upturned pot placed in a larger pot of water. I've gotten ants out of a jar of sugar this way. They leave to take the sugar away and drown.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .