Box fill isn't just the number of wires in the box — it's the total volume of the conductors, devices, and fittings in a box.
Every outlet box has a specific amount of space for conductors, devices, and fittings. We call that the box volume. You calculate box volume per 314.16(A) and box fill per 314.16(B), but make sure your 314.16(A) box volume is greater than or equal to your 314.16(B) box fill.
Box volume
Table 314.16(A) seems to make it simple to determine the volume of a box, but don't get too excited. You can use Table 314.16(A) only if the box contains no switches, receptacles, luminaire studs, luminaire hickeys, internal cable clamps, or equipmentgrounding conductors. This is rarely the case.
If Table 314.16(A) is inapplicable for your installation, which it typically will be, how do you calculate box volume? It's a matter of adding up individual volumes of assembled parts [314.16(A)].
Start with the box itself. If the box is not a standard size, the volume will be marked on the box by the manufacturer [314.16(A)(2)]. Then, add to it the sum of the individual volumes of the assembled parts, such as plaster rings, extension rings, etc. Include only those parts that are marked with their volumes in cubic inches [314.16(A)] or included in NEC Table 314.16(A).
Conductor volume
Calculating conductor volume is a matter of adding up individual conductor fill volumes and conductor equivalent volume fills — and there are five such volumes. After you calculate all five volumes using 314.16(B)(1) through (5), add them up using the equivalent volumes found on Table 314.16(B). The number you get is the total conductor volume. In no case can this exceed the box volume [314.16(A)].
In this process, you don't need to count raceway and cable fittings (including locknuts and bushings), wire connectors, or cable connectors with their clamping mechanism outside of the box. Nor do you need to count conductors that originate and terminate within the outlet box (such as equipmentbonding jumpers and pigtails) [314.16(A)].
Using 314.16(B), calculate each of the five following conductor equivalent volumes:

Conductor volume
Each unbroken conductor that runs through a box, as well as each conductor that terminates in a box, is counted as a single conductor volume. Each loop or coil of unbroken conductor having a length of at least twice the minimum length required for free conductors in 300.14 must be counted as two conductor volumes. Conductors that originate and terminate within the box (e.g., pigtails) aren't counted at all (Fig. 1).
You can omit equipmentgrounding conductors and up to four 16 AWG and smaller fixture wires from box fill calculations, if they enter the box from a domed luminaire or similar canopy (e.g., a ceiling paddle fan canopy) [314.16(B)(1) Ex].

Cable clamp volume
One or more internal cable clamps count as a single conductor volume, based on the largest conductor that enters the box. Cable connectors that have their clamping mechanism outside the box aren't counted.

Support fitting volume
Each luminaire stud or luminaire hickey counts as a single conductor volume, based on the largest conductor that enters the box.

Device yoke volume
Each single gang device yoke (regardless of the ampere rating of the device) counts as two conductor volumes, based on the largest conductor that terminates on the device.
A multigang device yoke that's too wide for mounting in a single gang box, as described in Table 314.16(A), is counted as two conductor volumes for each gang, based on the largest conductor that terminates on the device (Fig. 2).

Equipmentgrounding conductor volume
All equipmentgrounding conductors in a box count as a single conductor volume, based on the largest equipmentgrounding conductor that enters the box. Insulated equipmentgrounding conductors for receptacles having insulated grounding terminals (isolated ground receptacles) [250.146(D)] count as an additional single conductor volume.
Total conductors
What is the total number of conductors used for the box fill calculations in Fig. 3 on page 48?
Switch and conductors: five — 14 AWG*
Receptacles and conductors: four — 14 AWG**
Equipmentgrounding conductor: one — 14 AWG
Cable clamps: one — 14 AWG
Total = 11 — 14 AWG
* two conductors for the device and three conductors terminating
** two conductors for the device and two conductors terminating
Each 14 AWG counts as two cubic inches [Table 314.16(B)]. Therefore, 11 conductors × two cubic inches = 22 cubic inches.
If the cubic inch volume of the mud ring is not stamped on it or given in the problem, we cannot include it in the box volume. Without knowing the mud ring volume, a 4inchsquare by 2⅛inchdeep box would be the minimum required for this example.
Box sizing
To determine the size of the outlet box when the conductors are of different sizes, follow these steps:
Step 1: Determine the number and size of conductor equivalents in the box.
Step 2: Determine the volume of the conductor equivalents from 314.16(B)(1) through (5).
Step 3: Size the box by using Table 314.16(A).
Let's work an example. What is the minimum size square outlet box required for one 14/3 Type NM cable that terminates on a 3way switch, and one 12/2 Type NM cable that terminates on a receptacle? The box has internally installed cable clamps (Fig. 4).
Step 1: Determine the number of each size conductor.
14 AWG
14/3 NM = three — 14 AWG
Switch = two — 14 AWG
Total = five — 14 AWG
12 AWG
12/2 NM = two — 12 AWG
Cable clamp = one — 12 AWG
Receptacle = two — 12 AWG
Equipmentgrounding conductor = one — 12 AWG
Total = six — 12 AWG
All equipmentgrounding conductors count as one conductor, based on the largest equipmentgrounding conductor entering the box [314.16(B)(5)].
Step 2: Determine the volume of the conductors [Table 314.16(B)].
14 AWG = two cubic inches each
2 cubic inches × five conductors = 10 cubic inches
12 AWG = 2.25 cubic inches each
2.25 cubic inches × six conductors = 13.50 cubic inches
Total volume = 10 cubic inches + 13.50 cubic inches
Total volume = 23.50 cubic inches
Step 3: Select the outlet box from Table 314.16(A).
4 × 2⅛ square, 30.30 cubic inches meets the minimum cubic inch requirements.
Getting it right
Sometimes, you already have a box in place and need to make sure you don't overfill it. This could easily be the case during remodeling/retrofit work, or following a change order on new construction. Other times, you know how many conductors will go in a given run, and you need to make sure you install a big enough box. Either way, you calculate box volume and conductor volume. However, you can summarize the whole process this way:

If conductors are the same size, add them together and size the box using the AWG size columns of Table 314.16(A). Your conductor equivalents will all be the same size as the conductors.

If the box contains different sizes of conductors, use Table 314.16(B) to find the area of each conductor, add them up, and size the box from Table 314.16(A) using the cubic inch column.
But remember:

Calculating box volume is a matter of adding up individual volumes of assembled parts [314.16(A)].

Calculating conductor volume is a matter of adding up individual conductor equivalent volumes [314.16(B)(1) through (5)].
If box fill exceeds box volume, then you need to reduce the number of conductors or use a larger box.
Keep in mind that these are minimum requirements [90.1]. There's no penalty for using a box that's too big, other than the additional cost of that box versus a smaller one. It's typically more costeffective on a project to use a smaller quantity of box sizes and have a few that are oversized than to calculate the exact minimum needed at every point and try to match them all up in the field.