What is a Junction Box? How to Choose the Right One

Don’t let bad wiring short your circuit

Photo: photovs / iStock / Getty Images Plus / Getty Images
Photo: photovs / iStock / Getty Images Plus / Getty Images
Highlights

  • A junction box is a protective enclosure where electrical wires connect, splice, and safely distribute power.

  • Homeowners should match junction box size and material to wiring and location for safety and code compliance.

  • Junction boxes should be mounted to studs, joists, or other structural framing for stability.

Get quotes from up to 3 pros!
Enter a zip below and get matched to top-rated pros near you.
Geo Icon

They’re not pretty, and they’re definitely not the star of your renovation photos, but junction boxes do more for your home than most homeowners realize. Every time you flip a switch or plug something in, they’re working behind the scenes to keep your wires contained and things running safely. Skip one, and you’re risking shocks, shorts, or worse. Whether you’re tackling a small upgrade or just trying to understand what’s in your walls, knowing what a junction box does is a smart move—and way easier than fixing an electrical mess later.

What is a Junction Box?

A junction box is where electrical wires meet, get spliced, and head off in different directions to power your lights, switches, and outlets. Tucked into walls or ceilings, these enclosures—made of metal or plastic—keep wire connections safely contained and protected from dust, moisture, and damage. That protection is more than practical; it’s required. Electrical codes mandate a box at every wire splice to help prevent shorts, overheating, and potential fire hazards. Junction boxes aren't the flashiest or most aesthetically pleasing part of your electrical system, but without them, your whole setup risks becoming a mess of exposed wire connections and serious safety issues.

How Does a Junction Box Work?

Inside a junction box, electrical wires from different circuits come in through small openings with just enough insulation stripped back to expose the individual conductors and connect them safely. Wires of the same color and type—black for hot, white for neutral, and bare copper or green for ground—are twisted tightly together using wire nuts to create a secure link. Metal junction boxes get an extra grounding wire as an additional layer of protection that safely channels any stray electricity away. 

Once everything is connected, the wires are neatly tucked into place to avoid crowding. Finally, the box is sealed with a cover to keep out dust, moisture, and accidental touches.  Junction boxes should always be easily accessible. That way, if there’s ever a need to inspect or repair anything, you—or ideally a licensed electrician—can get to it quickly and keep your home’s electrical system safe, sound, and running smoothly.

Choosing the Right Junction Box

Junction box with exposed wires
Photo: vladimir soldatov / iStock / Getty Images Plus / Getty Images

Choosing the right junction box isn’t about grabbing the first one you see at the hardware store. What works perfectly in your living room might cause an electrical problem in your garage or out by the patio.  The trick is matching the box to your wiring, location, and the job it needs to handle, so your system stays safe, organized, and code-compliant. 

Material

Before you pick a box, consider where it will go and what kind of wiring you’ll use. 

Plastic (PVC):

  • Great for indoor residential jobs using non-metallic (NM) cable

  • Lightweight, affordable, and easy to install

  • Non-conductive, which means no grounding the box itself—skip it if you’re using metal-sheathed cable

  • Doesn’t rust but can crack under stress or high heat

Metal

  • Durable and fire-resistant

  • Can be trickier to work with (heavier, sharper edges, and may need knockout tools)

  • Stronger and more secure for mounting, especially for commercial and outdoor use

  • Best for armored cable or conduit systems; helps complete the ground path

Shape

The shape of your junction box ties into its functionality and the type of fixture or device its wires will house.

Rectangle

  • Most common for switches or single outlets

  • Compact, reliable, and easy to fit between studs

Square

  • Spacious enough for multiple wire splices or branching circuits

  • Can be adapted with covers to hold switches or outlets

Octagon

  • Frequently used in wall or ceiling installations (lights, smoke detectors, fans, etc.)

  • Provides good depth for wire connections

Round

  • Very shallow

  • Used for lightweight ceiling or wall fixtures

Size

The size of your junction box isn’t something you can ignore. It’s a matter of code. Electrical boxes are rated by volume (in cubic inches), and the National Electrical Code (NEC) sets strict limits on how much you can pack inside. For example, a 14-gauge wire takes up two cubic inches per conductor, and you’ll need to account for every wire, ground, device, and clamp—it adds up fast. That’s why choosing the right size box is critical.

A deep 4-inch square box is a great go-to for most residential projects, especially when you're dealing with multiple connections in the same area. It gives you room to work, helps prevent overheating, and makes for cleaner installs.

Tips for Installing a Junction Box

Electrical junction box with wire twists
Photo: Ivan Zatirka / iStock / Getty Images Plus / Getty Images

Installing a junction box isn’t rocket science, but it does demand a lot of care, patience, and electrical knowledge. Whether you’re adding a new light or rerouting a circuit, getting the basics right can save you future headaches—and possibly a call to an electrician. You need to focus on more than making things work. It’s about doing the project the right way so your wiring is safe and accessible.

  • Shut off the power at the main breaker before touching any wires.

  • Check your local electrical code to ensure your installation meets requirements.

  • Select a junction box that matches the job: material, size, and location.

  • Make sure the box remains visible and accessible after installation.

  • Mount the box securely to a stud, joist, or other framing.

  • Strip wire insulation cleanly, leaving about six to eight inches of exposed conductor for easy handling.

  • Use wire connectors to splice wires tightly and securely—don’t just twist and hope for the best.

  • Connect your electrical wires in the correct order: grounds first, neutrals second, and hots last.

  • If using a metal box, attach a grounding wire to the box itself for safety.

  • Avoid stuffing too many wires inside the junction box to prevent overheating.

DIY vs. Hiring a Professional

Wiring might look simple at first glance, but hidden inside a junction box, any mistake—like loose connections or overloaded circuits—can quietly turn into serious hazards. Unlike a leaky faucet or cracked drywall, electrical issues often stay hidden until they cause real damage or pose a safety risk.

Your local licensed electrician, with their years of training and experience, can spot potential issues before they become costly and dangerous. Their work helps guarantee that your system is safe, up to code, and built to last.

The cost of hiring an electrician typically ranges between $163 and $536, with most homeowners spending around $348. That’s a small price to pay compared to the potential fallout: electrical fires, failed inspections, or injury from a DIY mistake. When doing electrical work, hiring an electrician is always money well spent to protect your home and peace of mind.

Need professional help with your project?
Get quotes from top-rated pros.

The homeowners guide to electrical services

From average costs to expert advice, get all the answers you need to get your job done.