Which Wires Do I Connect to the Dimmer Switch?
The simple answer for a typical two-way dimmer switch is black on the dimmer goes to the black wire in the wall, the other black on the dimmer goes to the white wire in the wall and the green wire on the dimmer goes to the bare copper wire in the wall.
A two-way dimmer switch has three wires coming out of the back. Usually, two wires will be black and one will be green. However, it might have one red, one white and one green or one black, one white and one green. When installing your dimmer, remember electricity flows into it on one side and out on the other side. If your dimmer has two black wires, the orientation doesn’t matter. If there are different color combinations, attach red or black to the black wire in the wall or whichever wire is hot (has power). Use a voltmeter to check which wire in the wall has voltage if you are unsure. White is the neutral, or return, wire and should go to the white wire in the wall. The green wire simply goes to ground, or the bare copper wire, in the wall.
The purpose of a light switch is to cut the flow of electricity in the loop by making a break in the line. A dimmer switch accomplishes the same thing, but instead of cutting the electricity all at once, it slowly decreases the flow as you lower the slider.