Shocking your computer with static electricity can potentially cause serious damage to the delicate electronics inside it. You probably know this, which can make working on a computer upgrade or repair stressful if you don't understand how to prevent shocks from happening. Stopping them is actually pretty easy, though. You don't even need to buy an anti-static grounding strap. Shocks occur whenever the voltage differs between you and the thing you touch, and all you need to do to work safely is continually equalize the voltage between yourself and the computer components.
Wear low-static clothes that don't crackle or cling in dry weather. Cotton fabrics work well, like jeans and a plain T-shirt.
Video of the Day
Unplug your computer completely before opening the case. Remove every wire that comes out of it, including the power cord, data cords and all I/O devices like mice and speakers.
Ground yourself right before you sit down to work with your computer. You can do this by touching a conductive component like the screw on a wall light switch or the metal on your kitchen sink faucet. As you walk to the computer after grounding yourself, step lightly and don't drag your feet on the floor. Don't swing your arms as you walk so that they rub against your clothes at your side, either. These things can build up a charge.
Touch the metal computer case each and every time before you touch any hardware component or circuitry inside the computer. This doesn't ground you, but it equalizes the voltage between you and the computer, and it does so in the safest way -- through the sturdy case rather than the sensitive electronics. Though it gets repetitive, this step is vital.
Ground yourself again if you have to get up from your computer work and return to it.