How many containers fit in a 40-foot ground slot?

A ground slot is one stacking position in the yard, defined by its footprint and by however many tiers your terminal allows on top of it. The footprint tells you what size of box sits on the ground. It doesn't tell you how many containers that slot will hold over the course of a shift, a week, or a stack cycle. That second number comes from the stacking height limit, and that's where most of the confusion in this question lives.
What a ground slot is
In yard planning terms, a slot is the address: bay, row, tier. A 40-foot ground slot is sized to take one 40ft (or 45ft) box footprint per tier, as opposed to a 20ft slot, which takes one 20ft box or gets paired with a second 20ft box end to end in some yards to make up an equivalent FEU bay. Most terminals keep bay sizing consistent within a block so RTGs or RMGs aren't straddling mixed footprints mid-stack, but the mix does happen, especially in older yards built before container sizes standardized the way they have now.
So the slot itself is one footprint. The number of boxes that can occupy it, stacked one on top of the other, is a separate question entirely.
Stacking height limits set the real number
This is the number planners care about, and it's not fixed across the industry. It depends on:
Equipment reach. RTGs commonly work a stack of 1-over-4 or 1-over-5 (four or five containers plus the ground tier, so five or six total). Rail-mounted gantries on an automated stacking yard often go higher, sometimes 1-over-6 or more, because the crane geometry and rail gauge support it.
Laden versus empty. Corner-casting load limits mean a stack of laden boxes tops out lower than a stack of empties. A terminal running 1-over-5 for laden cargo might run empties two tiers higher in the same block, because there's less weight bearing down on the bottom box.
Reefer plugs. Reefer rows are capped by the power frame and plug height on the stack, lower than dry cargo stacking regardless of crane reach.
Ground conditions and wind exposure. Soft pavement, slope, or an exposed waterside row can force a terminal to cap height below what the equipment is rated for, purely as an operational call.
Put those together and the honest answer to "how many containers fit in a standard 40-foot ground slot" is: a stack of four to six is typical for conventional RTG yards, higher for automated stacking cranes, and the exact ceiling is whatever your own stacking policy says for that block, that cargo type, and that day's wind forecast. The limit comes down to the crane, the cargo, and the ground, not a fixed industry figure.
Why slot occupancy is the harder number
Knowing the theoretical max per slot gets you to capacity. It doesn't tell you how full the yard is right now, which is the number that matters when you're deciding whether to open a new block, delay a vessel call, or turn away empties. Occupancy is max stack height times footprint times however many of those slots are filled on a given day, and that last figure moves constantly: gate moves, vessel discharge, empty repo, all changing the count hour by hour.
Most terminals work this out from TOS data and periodic yard walks, which shows what the system has recorded, often a day or more behind the physical stack. Container Counting builds that picture a different way: a daily box count per block and bay, read straight off very-high-res imagery of what's stacked on the quay and in the yard, exported as CSV or a map layer before the port's own monthly statistics come out.
If slot occupancy is a number you're currently estimating rather than counting, it's worth seeing what a daily, imagery-based count looks like for your own yard.