The National Electrical Code, (NEC), dictates that no wiring splices are allowed outside of an approved enclosure. Any standard outlet, switch box or light fixture box, can serve as an approved enclosure, but where a wiring splice, needs to occur in other locations along the circuit, the approved enclosure is usually a junction box. A junction box is simply a standard electrical box, that is mounted securely to house framing or another structure, containing the connection or (splice) of two or more circuit cables. The cables are secured to the box with cable clamps or conduit connectors if the circuit includes conduit, and the box must have a removable cover, to create a complete enclosure. Junction box covers must remain accessible, they cannot be covered with drywall or other surface material.
A junction box is most often used where an electrical circuit branches off in two or more directions from a location where an outlet or fixture is not practical. It is also a common solution when an electrical circuit is being extended.
Make sure to buy a junction box appropriate for your installation. Outdoor locations, for example, require a weatherproof junction box, with gaskets to prevent moisture intrusion. And, make sure the junction box is large enough for the number of wiring connections you will be making. For example, the smallest 2 by 4 by 1 & 1/2-inch deep box can comfortably splice only two cables (four or five conducting wires), while the largest 4 by 4 by 2 1/8-inch-deep boxes can handle as many as four to six cables (up to 18 individual conducting wires). For easy installation, many DYI’s choose the largest box that is practical for the application.