What is the code rule on buried junction boxes?
A standard junction box cannot be buried. NEC 2023 Section 314.29 requires that boxes, conduit bodies and handhole enclosures be installed so the wiring inside is accessible without removing any part of the building or structure, and without excavating sidewalks, paving, earth or other substance that is to be used to establish the finished grade. The exception permits listed boxes and handhole enclosures for underground installations, provided the cover is accessible from grade without excavating.
What is actually permitted underground
There are three compliant ways to make a connection below grade. First, a handhole enclosure meeting 314.30, installed with its cover flush and accessible at finished grade, with a cover marked to identify it as electrical when the enclosure is not otherwise obvious. Second, a box specifically listed for direct burial, which will carry that marking on the enclosure and comes with sealing provisions for the conduit entries. Third, a splice made without a box at all, which 300.5(E) permits for direct buried conductors and cables using splice or insulation methods identified for the purpose, typically a listed inline splice kit, a heat shrink kit or an epoxy resin filled mold.
The third option is the one most people actually want. A listed direct burial splice kit lets you repair a damaged UF cable or extend a landscape lighting run without adding an access point at grade. It is a permanent, non reenterable connection, which is why the code accepts it in a location that cannot be inspected later.
Rules that go with it
Any box used in an underground or wet location must be listed for wet locations under 314.15, and conductors entering it need to be arranged so water does not enter or accumulate. Handhole enclosures under 314.30(B) need to be sized so conductors can be racked and pulled, and 314.30(C) requires splices and terminations in a handhole to be listed as suitable for wet locations. Underground raceway and cable cover depths still follow Table 300.5(A), which for residential branch circuits at 120 volts or less with GFCI protection and a maximum 20 amp overcurrent device can be as shallow as 12 inches for direct burial and 6 inches under a concrete slab.
The other trap is the sealed enclosure. Any raceway entering an underground box from a warmer location will condense water inside it, so 300.5(G) requires the raceway to be sealed or arranged to prevent moisture from entering equipment, and the enclosure itself should be provided with drainage.
Field takeaway
Do not bury a standard junction box. Use a handhole enclosure or a listed direct burial box with the cover accessible at grade, or eliminate the box entirely with a listed direct burial splice kit under 300.5(E).