There are ants in my laptop keyboard again. It's happened before and ended up killing my productivity occasionally as the little critters suddenly show up from within the gaps of the keyboard. I had to bring it over to my uncle and he got rid of the ants, somehow, but I forgot to ask how he did it.

How can I get rid of them?!

I've seen this post on Electronics.SE but it got closed, so it didn't get any helpful answers even in the comments.

  • 3
    It's an ASUS-ul20ft, if it helps. Also, I'm not positive on disassembling the laptop to a point where it's easy to clean, since I've tried reassembling three laptops and none of them have ever worked since.
    – Unihedron
    Commented May 26, 2015 at 8:53
  • 5
    related What's the best way to get ants out of laptop keyboards?
    – bummi
    Commented May 26, 2015 at 15:12
  • 56
    You just need to ... "debug" it (sorry, couldn't resist).
    – phyrfox
    Commented May 26, 2015 at 16:14
  • 12
    stop eating near your laptop. it will work. ants don't go where there isn't food.
    – user428517
    Commented May 26, 2015 at 18:20
  • 6
    What is this......... a keyboard for ants!?? Commented May 27, 2015 at 4:01

10 Answers 10


There are already some good answers for how to get them out immediately. However, I have an alternate proposal: Wait until they leave on their own.

They're there because there's food in there. As others have suggested, this is probably food or drink from your meals. If you let them work, they'll clean it for you by removing every trace of food. Once it's clean, they'll leave. They're not likely to build a nest in there or anything and they shouldn't be able to get down into any sensitive circuitry and get fried.

Pop out the battery. Find where they're getting inside. Put the laptop next to the opening. Wait until they're done. Keep food and drink some reasonable distance away from the keyboard.

This is especially effective if you've spilled a sugary drink on the keyboard. They can get rid of all the stickiness.

  • 7
    +1 for thinking outside the box. I've got a keyboard around here with a sticky control key (stays down when pressed). I should go find an anthill..... ;-)
    – RBerteig
    Commented May 26, 2015 at 23:19
  • 8
    So, if I spill something sugary on my keyboard in the future, I can just place it next to an anthill and it will be cleaned? Sounds awesome! This is probably even faster than disassembling the whole keyboard and cleaning the usual way.
    – Alex
    Commented May 27, 2015 at 7:17
  • 6
    It's how they clean bones at the Natural History Museum; after cutting off most of the meat, they leave the bones in a tank with beetles, and after a few weeks, they take them back out again, with all the flesh gone.
    – IQAndreas
    Commented May 28, 2015 at 6:55
  • If they can tolerate the temperature of the laptop while running, then they may be qute happy with using it as a nest, while foraging elsewhere for food.
    – mc0e
    Commented Mar 4, 2016 at 3:37
  • 3
    @mc0e I'm speaking from an antkeeper's perspective. In order to set up a nest ants need not only an appropriate temperature, but most importantly - areas with varying humidity. In the nest there have to be some places where moisture is high so they can keep their eggs and larvae. There is no way that they find these conditions inside a working laptop.
    – BuahahaXD
    Commented Mar 4, 2016 at 9:40

To remove almost anything, the simplest and most effective way is to use an Aero Duster. These blast compressed air in under the keys and into all the nooks and crannies and will safely leave your keyboard ant-free.

Of more importance is how to avoid ants deciding to colonise your laptop in the first place. You must have spilled something sweet in there at some point, so you may wish to avoid bringing food and drink anywhere near it.

If it is still attractive to ants, you can always pop it apart - all laptops are fairly easy to disassemble, as long as you know where the clips and screws are - and as all laptops are different, I'd suggest looking for a youtube video showing your particular one.

Additionally, when it isn't in use, put it back in a laptop bag. It will help.

  • 12
    "[...]all laptops are fairly easy to disassemble[...]" --> try disassembling a 10 years old Toshiba or a 4 years old Sony Vaio. Commented May 27, 2015 at 13:25
  • 2
    I had to take one apart yesterday. And I only evaluated my life 400 times. It was a really old Toshiba. It was around 80 screws, 10 plastic bits, the screen and a tonload of parts everywhere and cables to connect. I tested it 5 times to be sure. The more recent Toshibas are also a little harder than 4 years old ones. But the worst, are the Sony Vaio! Commented May 27, 2015 at 13:42
  • 3
    "all laptops are fairly easy to disassemble..." - twitter.com/Kirtaner/status/589164738870960128
    – IQAndreas
    Commented May 28, 2015 at 6:51
  • 23
    Disassembling the laptop never was the problem. It's putting the damned thing back together that gets me.
    – corsiKa
    Commented May 28, 2015 at 14:53
  • 5
    @corsiKa Putting it back together's not the problem for me. It's the leftover screws that's the problem :P note to self: take more photos Commented May 28, 2015 at 21:40

I am from India. We have good sunlight almost year-round. If I were you, then I would simply put my laptop in the sunlight for 5-10 minutes. The ants will leave the keyboard because it will get too hot for them. Be careful with a plasma display - sunlight will harm it!

  • 4
    Welcome to Lifehacks.SE! Could you please explain further why sunlight keeps away ants?
    – Alex
    Commented May 26, 2015 at 13:26
  • 6
    I would expect the whole thing to heat up relatively fast in direct sun light in a country like India. So it would get too hot for the ants and they would leave.
    – Nobody
    Commented May 26, 2015 at 13:30
  • 3
    holroy: It shouldn't be an issue. Heat generally is fairly fine for all computer parts up to somewhere >50C (ie >120F). What will cause a problems is if using it and the surface is at 50C, leading the CPU temp inside becoming >100C, leading to it crashing. Even then, odds are it will crash-out and shutdown without damage. Putting a computer in the sun, with it shut down should be no issue. --- There are 3 parts you have to worry about: Melting solder (Unlikely), Vaporising electrolytic capacitors, and I think most likely: Warping the Plastic Case. Commented May 27, 2015 at 13:14
  • 4
    @basher >Gonna need a source on it being hot in India. Srsly? The roads are melting at the moment
    – mcalex
    Commented May 28, 2015 at 5:16
  • 3
    Heat is not good for battery life, so take that out too
    – nafg
    Commented May 29, 2015 at 8:11

One way is to lure them out with something sweet and then not let them go back inside the keyboard.

Another is to suck them out with a vacuum cleaner or blow them away with a vacuum cleaner on reverse. Don't forget to take out your keyboard from the notebook to avoid blowing something unwanted inside.

Also you might want to try freezing them. Don't attach the keyboard back too soon after taking it out of the freezer though to avoid short circuiting due to possible condensation due to temperature difference.

Extreme solution: put your notebook in a sealed container, vacuum air out and insert a deadly gas >:) One easy gas is butane from a regular lighter.

  1. Put the keyboard inside a plastic bag where you can see what's going on inside and have good control of the lighter.
  2. Suck the air out with your mouth, it should not be dangerous unless your keyboard already contains deadly gases or you tried bug poison earlier. In that case use a vacuum cleaner hose.
  3. Press the lighter button, but don't light it, obviously. Let out enough gas so that the plastic bag inflates visibly, and the proportion of the air to gas is small enough to seem deadly for the ants.
  4. Leave for a day to be sure, but in a place where kids, fire and direct sunlight can't reach it. Or it could result in a noticeable explosion. Better put the plastic bag inside a more protective container, like a jar, in case ants decide to run for their lives and eat through the plastic bag, resulting in a leak.
  5. After you're sure the ants are dead, let out the gas inside the bag in conditions that would not result in gas explosion. The ants inside are probably not holding onto anything, so you can shake them out of the keyboard and plug it back in.

Simply vacuuming air out may not be effective because the ants are pretty small and who knows how long it would take for them to breathe through all the oxygen between the keys and the keyboard base. Saturating their air with a non-breathable gas should speed up the process sufficiently.

  • 5
    Do you have some kind of dark Nazi past? That evil smiley scared me...
    – Alex
    Commented May 27, 2015 at 7:22
  • 3
    Remove the battery before attempting this so that there won't be a follow up question of "How do I get charred ants out of my laptop?" Commented May 27, 2015 at 15:54
  • Umm, I'm talking about keyboard removed from the rest of the notebook exclusively, and there is no step involving prolonged high temperature treatment of the keyboard. There should not be any charred ants if you follow this procedure. Commented May 27, 2015 at 16:25
  • 1
    I can imagine small fire blasts coming from beneath the keyboard keys as you later run some demanding programs on the laptop which causes it to overheat. Commented Jun 1, 2015 at 11:40

Cut off their air/water/food, and they'll die. Just put your laptop in a sealed plastic bag for a couple days. A 2-gallon Ziploc freezer bag should do the trick.

enter image description here

*This only works if you can go without a computer for that long.

  • 8
    But then the OP will be posting "How can I remove dead ants from my laptop keyboard?" soon. Commented May 31, 2015 at 7:52
  • Hahaha true! That compressed-air canister idea will probably do the trick. Commented Jun 1, 2015 at 3:44
  • Even without doing this, I have so many dead ants under my keys that some of them are failing to work, and I'm having to take the caps off to clean them out properly. I just removed 30 or so ant bodies from under the enter key. There's no way compressed air could get them out from inside the hinge.
    – mc0e
    Commented Mar 9, 2016 at 12:58

I just read in Consumer Reports that ants hate cinnamon. Maybe a sprinkle of it would help. I have to agree with the other commenters though that making sure that you're not putting food in your keyboard is the best option. I know that you can buy plastic keyboard covers for just that purpose.

  • 1
    Can you link the writing?
    – Unihedron
    Commented May 26, 2015 at 23:47
  • 1
    This reports success, the theory being that ants avoid stuff that interferes with their smell trails. I simply put two copper coins near my front door to stop ants from wandering inside. Commented May 29, 2015 at 9:36

My wife discovered something that most ants loathe and detest. They will go to any lengths to avoid it and escape it. They will not go near it.

All you do is put a TINY amount on, in, or near any thing or area where ants are and… They're gone.

She first noticed its effect on tiny black ants in a bathroom and then with tiny pharaoh ants.

What is this magic ant repellant? CHANEL™ Body Powder.

Try a pinch on a sheet of facial tissue and put in in a plastic bag to coat the tissue lightly and evenly. You do not need much. After all, how much body powder does a tiny insect need for their tiny antibodies.

Put your infested piece on the tissue or lay the tissue on the keyboard. The ants will find their way out of any ports on the sides. Otherwise cover half of the keyboard so they can escape from the other side.

After the ants vacate the premises, the residue will keep the place void of them.

I'd love to watch. Good luck.

  • 1
    Now I wonder what the Chanel marketing people will do when they discover this post ;-)
    – Stephie
    Commented Aug 22, 2019 at 20:11

Wash your keyboard in the top rack of an automatic dishwasher. I do not recommend using dish washing liquid...many have bleach in them that will lighten some of the color of the keyboard plastic. Also, don't use a cycle that dries with high heat. Let the keyboard dry completely before using.


Diatomaceous earth. It is used in pest control, because it is actually comprised of tons of tiny edges, small enough that it does not hurt your (relatively) very thick skin, but will grate on insect exoskeletons, causing them to dry out.

Sources? Try google. There are many articles about how to use DE as pest control. In addition, you can sprinkle it on your garden (if you have one) to keep bugs away.

  • Let me understand this, you are adding sharp grains into your keyboard where they will destroy the contacts and jam the key mechanisms?
    – Chenmunka
    Commented Jan 11, 2021 at 18:14
  • I did not think this through, now that I really think about it, no, don't do this. should I delete this completely or edit to remove the 'use it here" part and keep it here as it is vaguely relevant?
    – Aidan Tung
    Commented Jan 13, 2021 at 3:50

Usually Boric powder works when trying to get rid of ants. But using it on laptop keyboard I am not sure. But probably safer than bug sprays. (Make sure laptop is switched off and battery removed).

You can bait them out by placing some sweet/sugar stuff on your laptop trackpad. And smash to kill as they come out.

p.s. avoid eating or keeping food items near your laptop to avoid future infestation.

  • I wouldn't suggest killing them when they are inside keyboard... They might be in some place that's not easy to take out. Commented May 26, 2015 at 14:58
  • 9
    DO NOT put boric acid on anything you'll be touching! This is a contact poison! Ditto and likewise for any other insecticide! Commented May 26, 2015 at 18:41

Not the answer you're looking for? Browse other questions tagged or ask your own question.