Open the switch box
Switch box with neutral wires
Switches don't need neutral wires. In this box, the two white wires connected with a wire nut indicate that a circuit runs through the switch box, and you can tie into it for a new outlet. If the switch box has only one white wire and it's connected to the switch (sometimes with black tape around it), it means the wire is hot—part of the switch circuit—and can't be used as a neutral.
First, check to see if the box contains a circuit you can tie into. Turn off the power to the switch box, remove the switch plate and unscrew the switch so you can examine the wires. If there's a pair of neutral (white) wires that aren't connected to the switch, you're in luck (see photo). You can then add the new black wire to the black, the white to the white, and the ground to the ground wires. However, keep in mind that the switch box might contain other wires or have improper connections. If you're not sure, look elsewhere or call a licensed electrician to advise you.
Second, do a wire count to make sure the box is big enough for the three new wires (see chart). The box size (in cubic inches) is often stamped on the inside of the back. If it's not, measure the width, height and depth of the box and multiply to calculate its volume. If the box isn't large enough, replace it with a larger one or look for another place to tie in.
Use this chart to determine if the switch box is big enough for more wires.
Before starting, turn off the power to the circuit. Before touching any bare wires or terminals, use a voltage tester on all the wires to make sure the power is off. If you have aluminum wiring, call in a licensed pro who's certified to work with it. This wiring is dull gray, not the dull orange that's characteristic of copper.