Box fill is the room a box needs for everything inside it. NEC 314.16 gives each item an allowance in cubic inches, set by wire size: 2.0 cu in for 14 AWG, 2.25 for 12 AWG and 2.5 for 10 AWG. The allowances are added, and the total may not be more than the box volume. Choose the box and enter what goes in it; the result gives the total against the box and the smallest metal box of each type that holds it. Take a receptacle box fed by two 12/2 cables with internal clamps: four 12 AWG conductors are 9.0 cu in, the clamps 2.25, the receptacle 4.5 and the two grounds 2.25, 18.0 in all. The 3 x 2 x 3-1/2 device box is exactly 18.0 cu in, so it fits with nothing to spare.
Each wire that comes in from outside the box counts once, whether it ends there, is spliced or passes straight through. An unbroken loop counts twice when it is at least twice the 6 in free length of 300.14, so 12 in or more. A pigtail that starts and ends inside the box counts nothing. Internal cable clamps count once together, however many there are. Fixture studs and hickeys count once for each type, not each piece. Each device yoke or strap counts twice. Up to four grounds count once together, and each ground past four adds a quarter. Since the 2023 edition, each terminal block counts once, however many poles it has.
The wire size behind each allowance depends on the item. Clamps and support fittings take the largest conductor in the box. The code sizes a terminal block by the largest wire terminated on it; the calculator uses the largest in the box, which is never smaller. Grounds take the largest ground entering the box, and a device the largest conductor connected to it. With two 12 AWG and three 14 AWG conductors, clamps, a device wired in 14 AWG and three grounds, the largest 12 AWG, the device counts 4.0 cu in rather than 4.5 and the total is 19.0. That is too much for the 18.0 device box, and no single-gang device box in the table holds it; the smallest square box that does is the 4 x 1-1/2, at 21.0.
For a metal box in Table 314.16(A), the volume is the table figure. The chart below gives the most conductors of one size for each of its 24 boxes: the volume divided by the allowance, rounded down. 21.0 ÷ 2.25 is 9.33, so a 21.0 cu in box holds 9 of 12 AWG. The 2023 edition corrected the 4 x 1-1/4 round or octagonal box at 8 AWG from 5 to 4. Nonmetallic boxes, and other boxes of 100 cu in or less that aren't in the table, are marked with their volume by the manufacturer; choose "Other box" and enter the marking. A plaster ring, extension ring or domed cover marked with its volume adds that volume.
Most box fill errors are counting errors. Counting each clamp or stud adds allowances the code doesn't ask for: one extra clamp allowance takes the receptacle box above to 20.25 cu in, and the 18.0 box wrongly fails. Sizing grounds or a device by the largest wire in the box can overstate it too; in the 19.0 example, a 12 AWG device allowance gives 19.5. A single wire size for the whole box can't count a mixed box, and the quarter for each ground past four needs the number of grounds, so the calculator asks for both.
Some rules are left to you. A device wider than a single 2 in device box counts twice for each gang it needs, so enter one device per gang. A ground and up to four fixture wires smaller than 14 AWG that come from a domed luminaire or similar canopy and end in the box aren't counted. Conduit bodies follow 314.16(C), which the calculator doesn't cover, and the minimum box depth for a device is set by 314.24(B), not by box fill. Local amendments can change any of this, and the inspector's reading is the one that counts.