Can I put a junction box inside a wall?

A junction box, also known as a splice or switch box, is an electrical enclosure inside your home that contains wiring. Electrical wires run behind the walls and through the ceiling of your home, meeting at junction boxes. It is a safety hazard to completely bury a junction box in a wall.

See further detail related to it here. Correspondingly, can you splice wires inside a wall?

Spliced wires are not to be held together with electrician's tape. Electrical wires are never left on their own in the wall cavity or ceiling. Instead, all splices must be contained within a junction box and the individual wires attached with wire nuts.

Also, how do you replace a junction box? How to Remove a Metal Junction Box

  1. Turn off the circuit to the metal junction box at the main service panel.
  2. Untwist any wire connectors from wires inside the box.
  3. Look inside the metal junction box for where the wires enter.
  4. Examine the interior of the box for any screws in the sides or the back of the box.

Then, can you use a junction box to extend wiring?

If you do need to extend the wires, yes, a junction box would be needed. It must remain accessible. You've pretty well identified your two choices; if you don't want to re-run longer cables, you'll need to splice in some additional cable.

How do you install a junction box?

Mount the Box Separate the circuit wires at the existing splice and loosen the cables as needed to make room for the new junction box. Mount the box to the framing (or other support structure) with screws driven through the factory-made holes in the back or side of the box, as applicable.