How do you count the number of wires in a fill capacity of an outlet box?
I use a shorthand version of the full NEC treatment. Start with this table that says how much space for each wire size.  




Pick  your largest ground wire and look it up and add it once. All other grounds are free.  If you have four #14 grounds and one #8, that's 3.00 cubic inches. 
Any cable clamps? Pick the largest wire clamped, ditto. Covers all clamps.
Any support brackets? Pick the largest wire associated with the supported item, look it up. it counts once. 
Pigtails are free. 
Other than that, every wire passing through entering and terminating in the box in a cap, splice or device, costs what the table says.  e.g. if you have two 12/2 cables into the box, grounds are already accounted for leaving 4 wires, x 2.25 cubic inches = 9.00.  
2 wires nutted together don't count as one, sorry. 
Any wires over 12" length, look it up, that per extra foot. 
For each yoke, what's the largest wire going onto that yoke?  Look it up and count it twice.  So if you have a 10AWG wire in there for some reason, that yoke counts as 5.00 c.i. 


There should be a stamping on the box saying how many cubic inches it is.  Common box sizes have official sizes, and the sales literature for those boxes will also say.  

What's a yoke? A switch, receptacle, GFCI etc.  Yes I know they are dramatically different sizes. I don't write the rules.  



So as an exercise.  Box in EMT conduit.  You have four #6 THHN wires (hot hot neutral ground) passing through the back of the box on their way to a subpanel.  You also have #14 hot and neutral THHN coming in, going to a receptacle at this box.  Then 14/2 Romex going out to some other location, with a clamp, and its ground goes to the steel box case.   You have: 

1 ground, largest is #6 so 5.00. 
3 #6 wires, so 15.00. Its ground was counted earlier. 
4 wires #14 (the Romex ground was counted earlier) so 8.00.
1 receptacle, largest wire involved is #14, x2 so 4.00. 
1 cable clamp, largest clamped is #14 so 2.00. 


You need 34 cubic inches total.  It's a 120mm x 1.5" box, that's 29 cubic inches, so you get a raised receptacle cover that gives 5 more cubes and you're done.