How to clean a mechanical keyboard
Most intermittent keys are debris, not failed switches. Here is how to clean a board properly, including what not to do.
Before assuming a switch has failed, clean it. Debris under a keycap produces exactly the same symptom as a dying switch, and it is far more common.
Test the board first so you know which keys are actually misbehaving, then test again afterwards. That before and after is what tells you whether cleaning fixed anything or whether you are looking at a real switch failure.
Level 1: surface clean, five minutes
Unplug the keyboard. Turn it upside down and shake gently, which removes more than people expect. Then compressed air, holding the can upright and blowing across the board at an angle rather than straight down. Straight down drives debris deeper into the switch housing.
Finish with a barely damp microfibre cloth over the caps. Isopropyl alcohol at 70 percent or higher is safe on most keycaps, though it will attack printed legends on cheaper caps, so test an unimportant key first.
Level 2: keycaps off, thirty minutes
This is the one that fixes intermittent keys.
- Photograph the layout before you start. You will not remember where the less common keys go, and this takes five seconds.
- Pull the caps with a wire keycap puller. Wire is much gentler than the plastic ring type, which scratches. Pull straight up, rocking slightly if a cap is stubborn.
- Leave the large keys for last. Space, shift, enter and backspace usually have stabilisers. Note how the wire sits before removing them, because reseating a stabiliser wrong gives you a rattly or sticking key.
- Soak the caps in warm water with a little washing-up liquid for a few hours. Rinse thoroughly and let them dry completely, which takes longer than you think. Fitting a damp cap traps water in the switch.
- Clean the exposed board with compressed air, then a soft brush for anything stuck. Cotton buds with isopropyl handle the plate between switches.
- Test the bare switches by pressing the stems directly before you refit anything. A key that works now but failed with the cap on had debris in the cap or the stem.
Level 3: the switch itself
If a key still misbehaves with the cap off, the switch has debris inside it or has failed.
On a hot-swap board, pull the switch with a switch puller and either clean it or fit a spare. Thirty seconds, no tools beyond the puller.
On a soldered board, a switch can sometimes be opened in place if you can reach the housing clips, though it is fiddly. Otherwise it is a desoldering job.
Either way, a short burst of contact cleaner into the housing while working the stem resolves a good share of intermittent switches.
What not to do
Do not use a vacuum cleaner directly on the board. Static discharge from a domestic vacuum can damage the controller, and the suction can pull keycaps or springs away where you will not find them.
Do not use rubbing alcohol on the PCB while it is connected. Disconnect, clean, and let it dry fully before power.
Do not soak a keyboard with the electronics in it, ever, including “it worked for someone on the internet”. Caps yes, board no.
Do not force a keycap. If it will not come, you are pulling at an angle or it is a stabilised key with the wire still hooked.
For a membrane keyboard
Most of this does not apply. Caps generally do not come off cleanly, the contact layer is sealed, and there is no switch to clean. A surface clean is the realistic limit, and a key that has worn through its contact pad is not economically repairable.
Common questions
Can I put keycaps in the dishwasher?
ABS keycaps will survive a low temperature cycle with no heated dry, but the legends may not, especially printed or pad-printed ones. PBT caps handle it better. A bowl of warm soapy water and a few hours of soaking is safer and works just as well.
Is compressed air enough on its own?
Often, for light dust. It is much less effective on anything sticky, and it can push debris further into a switch rather than out of it. Hold the board at an angle and blow across rather than straight down.
What about a keyboard that had liquid spilled on it?
Disconnect it immediately and do not power it on. Corrosion continues after the liquid dries, so speed matters more than technique. Full disassembly and cleaning with isopropyl alcohol within a day or two saves many mechanical boards. Sugary drinks are far worse than water.
How often should I do this?
A surface clean every couple of months, and a full keycap removal once or twice a year for most people. More often if you eat at your desk, which is the single biggest predictor of how bad it gets.
My key still fails after cleaning.
Then it is likely the switch rather than debris. On a hot-swap board the switch pulls out and a spare goes in with no soldering. On a soldered board it is a desoldering job, and on a membrane keyboard it is not economically repairable.