How can I remove ants from my laptop keyboard?



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.


Posted 2015-05-26T08:46:22.410

Reputation: 600

3It'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 – 2015-05-26T08:53:56.370


related What's the best way to get ants out of laptop keyboards?

– bummi – 2015-05-26T15:12:57.380

46You just need to ... "debug" it (sorry, couldn't resist). – phyrfox – 2015-05-26T16:14:41.330

6stop eating near your laptop. it will work. ants don't go where there isn't food. – ell – 2015-05-26T18:20:00.497

1Try putting your laptop in the freezer for a few days. – Bob Jarvis – 2015-05-26T18:39:28.130

6What is this......... a keyboard for ants!?? – enthdegree – 2015-05-27T04:01:30.470

2@BobJarvis only the keyboard though. You don't want to risk condensation on other parts of the notebook if you can avoid it. – user1306322 – 2015-05-27T09:55:41.343

1Stop eating on your laptop, for goodness sake! – epalleva – 2015-05-27T09:49:55.997


Find some anteater (, of course...

– woliveirajr – 2015-05-27T12:29:17.230

@BobJarvis — I'm pretty sure, when you take it back out, you'll just have colder ants. Most insects do pretty well with freezing, and thaw out just fine afterwards. – BRPocock – 2015-05-27T21:22:44.283

2You know what would make this question even better? Photographs. – IQAndreas – 2015-05-28T06:47:05.193

@IQAndreas I'm not sure how you'd expect me to take a photo when I see ants in my keyboard over screaming and running away, but sure, I'll take a picture if they appear again. I've adopted and attempted some of the solutions in the answers and they're mitigating the problems rather well though. – Unihedron – 2015-05-28T10:27:33.383

What is this, lifehacks for ants? – corsiKa – 2015-05-28T14:52:08.277

@corsiKa I'd like you to say that when it's you who has ants in their keyboard. >:| – Unihedron – 2015-05-28T14:54:59.893

1@Unihedron who's screaming and running away? The ants? – algiogia – 2015-05-29T10:29:32.607


This really should have been on LH seems to be randomly sucking good questions from other sites lately, especially SU and Cooking. In any case, the existing SU question is easy enough to find, downvoted due to lack of research effort.

– Captain Obvious – 2015-05-31T07:54:45.870

Ants may nest in a laptop even if there is not food that attracts them to it. This solution has worked for many people:

– i_a – 2015-10-03T15:21:13.487



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.

Engineer Toast

Posted 2015-05-26T08:46:22.410

Reputation: 1 475

5+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 – 2015-05-26T23:19:44.130

8So, 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 – 2015-05-27T07:17:19.823

5It'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 – 2015-05-28T06:55:32.070

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 – 2016-03-04T03:37:59.047

2@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 – 2016-03-04T09:40:55.117

@BuahahaXD I've seen ants nest in a dry coke can under cover. That was in a relatively cool and damp climate though. Perhaps the limiting factors on where ants will nest vary with climate and species? – mc0e – 2016-03-04T13:28:48.193

@mc0e Have you seen them keeping the eggs and larvae there? Have you seen the queen? – BuahahaXD – 2016-03-07T10:34:50.947

@BuahahaXD In the coke can, yes. The ants are out of my laptop now, though I'm still working on getting them out of the monitor stand which has no sign of eggs. – mc0e – 2016-03-07T12:09:06.247

Actually it was only the live ones that were out of my laptop. Thousands of dead. – mc0e – 2016-03-09T13:01:34.470


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.

Rory Alsop

Posted 2015-05-26T08:46:22.410

Reputation: 946

10"[...]all laptops are fairly easy to disassemble[...]" --> try disassembling a 10 years old Toshiba or a 4 years old Sony Vaio. – Ismael Miguel – 2015-05-27T13:25:15.083

Yep - admittedly I had already been disassembling laptops for >10 years by that point so had had practice – Rory Alsop – 2015-05-27T13:33:51.430

2I 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! – Ismael Miguel – 2015-05-27T13:42:16.170

time consuming, but very straightforward and simple to do. – Rory Alsop – 2015-05-27T13:52:00.887

3"all laptops are fairly easy to disassemble..." - – IQAndreas – 2015-05-28T06:51:38.860

20Disassembling the laptop never was the problem. It's putting the damned thing back together that gets me. – corsiKa – 2015-05-28T14:53:28.660

4@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 – Danny Beckett – 2015-05-28T21:40:06.313

FWIW with Lenovo W540, at least, be very careful, it's very easy to pop keys off when attempting to open the keyboard – nafg – 2015-05-29T08:09:14.547


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!


Posted 2015-05-26T08:46:22.410

Reputation: 181

4Welcome to Lifehacks.SE! Could you please explain further why sunlight keeps away ants? – Alex – 2015-05-26T13:26:37.940

6I 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 – 2015-05-26T13:30:20.383

I have no idea how this works , but I've been doing this for various things from containers to raw food items. – None – 2015-05-27T01:17:27.920

1I'm not sure how healthy this is for your computer, though. You could end up harming the computer due to overheating. – holroy – 2015-05-27T09:05:02.140

2holroy: 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. – Lyndon White – 2015-05-27T13:14:21.263

1Some of the information contained in this post requires additional references. Please edit to add citations to reliable sources that support the assertions made here. Unsourced material may be disputed or deleted. Gonna need a source on it being hot in India. I don't buy it, and neither does SE. – basher – 2015-05-27T15:54:39.213


@basher >Gonna need a source on it being hot in India. Srsly? The roads are melting at the moment

– mcalex – 2015-05-28T05:16:12.803

1@mcalex I guess you're not very familiar with sarcasm? All the answers here are using personal experience as a reference, but this post is singled out as requiring additional references. I too wonder why that is. – Erwin Bolwidt – 2015-05-28T12:47:06.957

3Heat is not good for battery life, so take that out too – nafg – 2015-05-29T08:11:27.310

1Yes this answer easy anmong the others.. Because Ants cant tolerate high heat – Babel – 2015-06-09T08:07:48.263

@nafg Agree that heat is not good for battery life. So you can remove the battery & then put laptop in sun light. & BTW I advised to put laptop in sun light for 5-10 minutes only. I dont think this is too much time that battery or laptop will become that much hot. – Kedarnath – 2015-06-17T05:09:13.157

I've got a Lenovo X220. I probably don't need the sun to heat it up, I just turned the laptop on and the ants came streaming out. But after half an hour they're still coming out. – mc0e – 2016-03-04T03:24:20.753

What I do is play a game for an hour or so to kick off the heat and fans to drive away the ants. but if I shutdown the laptop, they're back. So now I just keep it running. – ShahiM – 2017-01-11T08:20:56.343


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.


Posted 2015-05-26T08:46:22.410

Reputation: 573

5Do you have some kind of dark Nazi past? That evil smiley scared me... – Alex – 2015-05-27T07:22:32.083

3Remove 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?" – GuitarPicker – 2015-05-27T15:54:51.453

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. – user1306322 – 2015-05-27T16:25:40.720

1I 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. – Praxis Ashelin – 2015-06-01T11:40:36.043


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.


Posted 2015-05-26T08:46:22.410

Reputation: 8 237

4But then the OP will be posting "How can I remove dead ants from my laptop keyboard?" soon. – Captain Obvious – 2015-05-31T07:52:55.563

Hahaha true! That compressed-air canister idea will probably do the trick. – BrettFromLA – 2015-06-01T03:44:10.060

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 – 2016-03-09T12:58:45.247


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.


Posted 2015-05-26T08:46:22.410

Reputation: 31

1Can you link the writing? – Unihedron – 2015-05-26T23:47:11.630

1This 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. – Cees Timmerman – 2015-05-29T09:36:27.253


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.


Posted 2015-05-26T08:46:22.410

Reputation: 1


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.


Posted 2015-05-26T08:46:22.410

Reputation: 177

I wouldn't suggest killing them when they are inside keyboard... They might be in some place that's not easy to take out. – Farid Nouri Neshat – 2015-05-26T14:58:33.900

9DO NOT put boric acid on anything you'll be touching! This is a contact poison! Ditto and likewise for any other insecticide! – Bob Jarvis – 2015-05-26T18:41:58.017