How to clean a keyboard without damaging it

Unplug the keyboard or shut the laptop down, turn it upside down and tap out the crumbs, then blow short bursts of compressed air between the keys with the can held upright. Wipe the keys with a soft cloth that is only damp, with water or the cleaner your keyboard's maker allows, and never spray or pour anything onto the keyboard. Then press every key once to check that each still works.

Keyboard test

Where the dirt goes Short bursts, can upright Keycap Switch Crumbs and dust
Each keycap sits on a switch, and the gap around it lets crumbs, dust and hair fall onto the plate underneath. Turning the keyboard over brings out what is loose; air blown in at an angle lifts the rest from under the keycaps. Liquid runs into the same gaps, which is why the cloth should only ever be damp.

What you need

1. The quick clean, for every keyboard

  1. Unplug the keyboard, or switch it off and take out removable batteries. Shut a laptop down and unplug its charger.
  2. Turn the keyboard upside down over a bin and tap the back gently to shake out the crumbs.
  3. Blow compressed air between the keys in short bursts, row by row across the whole board. Keep the can upright: tilted or upside down it can spray liquid propellant, which is freezing cold. No can? A vacuum with a dusting brush, or a hair dryer on cool air, does the same job.
  4. Wipe the keys and the frame with a soft cloth lightly dampened with water, or water with a little mild soap. Wring it out so nothing drips between the keys.
  5. Run a cotton swab along the gaps and the sides of the keys, then dry everything with a dry part of the cloth.

2. Laptop keyboards

3. Mechanical keyboards and keycaps

  1. Take a photo of the keyboard first, so every keycap goes back in its place.
  2. Pull the keycaps straight up with a keycap puller. Leave the long keys (space bar, Shift, Enter, Backspace) on unless they need it: they sit on metal stabilizer wires that are fiddly to refit.
  3. Blow or brush the dust off the plate between the switches, and wipe around the switches with a cotton swab dampened with isopropyl alcohol. Do not drip anything into a switch.
  4. Soak the keycaps in warm (not hot) water with a little dish soap for about 30 minutes, scrub them gently with a soft toothbrush, rinse, and let them dry completely before you fit them back. Water left inside a keycap runs into the switch.
  5. Push each keycap straight down until it sits fully on its switch.

Sticky keys and grime

A key that sticks or feels gritty usually has a dried drink or grease around it. With the keyboard unplugged or the laptop off, clean around the key with a cotton swab lightly dampened with isopropyl alcohol and let it dry fully. On a mechanical keyboard, pull the keycap first, clean around the switch and press the switch a few dozen times to work the residue loose. If Shift, Ctrl or Alt stays held after you let go, that is not dirt but the Sticky Keys setting: see how to turn off Sticky Keys.

Water or alcohol? What the makers say

The makers do not agree on how strong a cleaner their keyboards can take, and strong alcohol can rub the printed letters off some keycaps. Follow the maker of your keyboard, and try anything stronger than water on a hidden spot first.

Water or alcohol? What the makers say
MakerEveryday wipeAlcohol
AppleA lint-free cloth lightly dampened with water70% isopropyl or 75% ethyl alcohol wipes on hard surfaces such as the keyboard, with no moisture in any opening
MicrosoftA lint-free cloth or cotton swab with mild soap and waterIsopropyl alcohol of 70% or less, put on the cloth
LogitechA soft, lint-free cloth lightly dampened with tap waterWipes or swabs with less than 25% alcohol; isopropyl alcohol only for stubborn dirt, tried on a hidden spot first
HPA slightly damp microfiber clothIsopropyl alcohol of 70% or more, on a cloth or cotton swab

Apple, Microsoft and Logitech all say to put the cleaner on the cloth, never on the keyboard. Apple and Logitech also rule out bleach, strong solvents and abrasive cleaners, and Logitech names acetone (nail polish remover).

After a spill

Unplug the keyboard, or shut the laptop down and unplug it, at once. Turn it upside down so the liquid drains out, blot what you can reach with a lint-free cloth, and leave it to dry for at least 48 hours before you switch it on. Water often dries out without harm; coffee, soda and juice leave a sticky film that needs the sticky-key cleaning above. If liquid got inside a laptop, take it for repair as soon as you can rather than opening it.

How often

Microsoft and HP both suggest a clean once a month, which stops crumbs building up under the keys. Clean at once after a spill, and keep food and drinks away from the keyboard; clean hands keep oil off the keycaps.

Then test every key

Plug the keyboard back in and press every key once on the keyboard test: each key lights up when the computer receives it. If some keys still do not respond, see keyboard keys not working. A key that now types twice is chatter: see why a keyboard types double letters.

Sources: Apple, How to clean the keyboard of your MacBook and How to clean your Apple products; Microsoft, How do I clean my Microsoft mouse or keyboard?; Logitech, Cleaning your Logitech device; HP, How to clean a keyboard.