Things You'll Need
Electrical insulation tape
When an electrical cable is not long enough to reach from one switch/receptacle to another, a junction box is placed somewhere in between, so that two shorter cables can be connected together in the box. The cables enter the box through knockout covers, and each of the cable's wires connect together with wire nuts. If the junction box has to be moved, the cables are first disconnected from each other and then rejoined in the junction box's new location.
Video of the Day
Turn off the power to the circuit to which the junction box attaches by flipping the corresponding circuit breaker in the home's breaker box. Turn on a light switch, or plug a portable electrical appliance into a receptacle, to make sure the correct breaker has been turned off.
Unscrew and remove the breaker box's cover, and pull out the wires from inside. Unscrew all wire nuts from the ends of the wires. Loosen the screws on the cable clamps attached to the box's knockout covers, and pull the cables out of the box. Remove the screws holding the box to the wall.
Position the box in its new location, attaching it in place with the screws -- if screwing directly into drywall. Mark the box's screw holes on the wall. Punch through each mark on the drywall with a small screwdriver. Insert wall plugs into the holes and screw the box to the wall plugs. Remove any cable tacks holding the cable to wall studs by prying them out with pliers.
Position the cables so that they run to the box's new location, and insert cable tacks every 18 inches to hold them in place. Push the cables through the center of the cable clamps, and into the box. Tighten the cable clamp's screws to hold the electrical cables in position.
Cut off the bare ends of all electrical wires if the ends are damaged, using wire cutters. Cut back 1/2-inch of plastic coating from all wire ends using wire strippers -- the ground wires will be bare. Hold together all wires of the same color, and screw on a wire nut. Make sure the nut covers all bare copper on the end of the wires. Wrap electrical insulation tape around the nut and area where the wires enter into the nut. Repeat these steps with all colored wires, including the bare ground wires.
Push the wires and nuts into the box. Space out the wire nuts so that they don't touch each other. Place the box's cover in place and screw it in position. Turn on the power at the breaker.
If the electrical cables are not long enough to reach the box's new location, it is best to run new cable from the switches/receptacles on each side of the junction box and dispense with the junction box entirely. Alternatively, a second junction box could be installed to the end of one cable with a new cable, and then running from one box to the other. However, this should be approved by the city electrical permit office first so that it complies with local building code.