If you spill coffee, water, or some other liquid on your laptop’s keyboard, the first thing to do is not panic. The second thing to do is to turn off the power, because water and electricity are an unpleasant combination. If the laptop is running off the battery, you can safely depower using Windows shutdown procedures or by pressing and holding the on/off switch (on most laptops). But if the laptop is running off an AC adapter, be sure that the adapter and the wiring that runs to the wall outlet are not wet. If they’re even damp, don’t touch them and instead turn off the power at the circuit breaker.

With the power turned off, disconnect and remove the battery. Then you can begin to clear the spill by blotting it up with absorbent towels.

The good news is that most laptops have a plastic or rubber-like membrane beneath the keycaps, and your assignment may be removal of the keys and a careful cleaning. If somehow the liquid has gotten into the laptop’s innards — the hard drive, the motherboard, or other parts — the extent of damage may depend on what was spilled. Water will dry without leaving a residue; if nothing shorted out at the time of the spill, the machine may be ready to return to service in a day or so once it has fully dried. (Do not use a hair dryer or other heated source to dry the machine; you can use a gentle flow of air from a fan.) Coffee or soda, though, both dry as sticky, corrosive gunk, and you may have to send the machine to a professional shop to be disassembled and cleaned.

If the AC adapter became totally soaked, consider purchasing a replacement. Do not attempt to open it yourself and make repairs.