New wall receptacles and switches will have two types of contacts: screws on the sides for 10, 12 and 14 awg (american wire gauge) wire and holes in the back that accept 14 gauge wire only. Because of this limitation the holes can only be used to wire 15 amp circuits. For 20 amp circuits using 10 or 12 gauge wire, use a receptacle rated for 20 amps and connect it using the terminal screws on the sides.
Use the same type of receptacle as the current one for replacement. Never replace an ungrounded receptacle with a newer, grounded one if no ground wire is present. This will create a risk of electrocution. A switch can be replaced with the same type or you can change to a rheostat. The grounding terminal on a new switch can be ignored if the existing circuit has no ground wire. Check out wiring switches and wiring 3 way and 4 way switches for more choices for lighting control.
Shut off the electricity at the service panel for the circuit you will working on. Test the circuit using a known working lamp or other electrical device to be sure it is off. Flip the switch to be sure the bulb doesn't light. If there's no bulb in the fixture, use a meter to be sure the circuit is off. Remove the cover plate and the top and bottom screws holding the receptacle or switch to the outlet box. These are long screws and easier to remove with a drill–driver.
Grasp the top and bottom brackets and pull the receptacle or switch from the outlet box so you can reach the sides and back. If you will be disposing of the old device remove the contact screws holding the wires. Removing the screws will make it much easier to free the stiff wires. Leave the wires bent into a hook if you will be using the screws to connect the new device. If you will be using the holes in the back for 14 gauge wire, cut the wires right below the hook so you will have a straight wire to insert into the holes. Strip about ½inch of insulation from the wires. See Wire Splicing for more.
If the current receptacle or switch is connected to the wires through the holes in the back, push a jewelers screwdriver or similarly shaped tool into the slot next to each hole to release pressure on the wire. Pull the wire from the back while holding the spring down.
Attach the wires to the new switch or receptacle. On a switch, connect the hot source wire to the bottom switch terminal. Connect the wire running to a light or receptacle controlled by the switch, to the top terminal. On a receptacle the black wire goes on the hot, positive (+) or brass colored screws. Connect the white wires using the neutral, negative (-) or silver colored screws. If there are two sets of wires, keep them in sets using the top contacts for one set and the bottom for the second set. If you are using the holes in the back to connect 14 gauge wires, push them into the proper holes until the spring engages, locking the wires in place. Pull hard on each wire to be sure it is securely connected.
Connect any ground wire, this may be a bare copper or green wire, to the ground, black or green screw. There is no hole in the receptacle or switch for the ground wire, only a screw.
Leave the device hanging free and test it to be sure the wiring is correct. Use a receptacle analyzer or plug in a lamp and turn on the circuit at the service panel. Flip a new switch to be sure it is working. If there's a problem with the wiring turn the power off again and correct the problem.
If the wiring is correct turn the power off and install the receptacle or switch in the outlet box. Fold the cable and push the device with your palm until it sits flat on the box. Drive the bracket screws and shift the replacement left or right as necessary to square it in the box. Install the cover plate, turn the circuit back on and test the device again.