Total wires in a receptacle duplex box
Table 314.16.A provides box fill for standard boxes:


a 3x2x1-1/2 box is listed for 3ea 14 gauge conductors (7.5 cu inch box)
a 3x2x3-1/2 box can have 9# 14 conductors (18 cu inch box)


The calculation for #14 wire is

    # of conductors x 2 cu in. + 2 cu. in. for all the grounds. (Only count 1x for all the grounds.)
  + 4 cu in. per device 
  + 1x if the box has clamps (1x 2 cu. in.) only count 1 even if there are more.
  = total cu inches or less is acceptable unless an extension ring/adapter is possible ( referred to as plaster/mud rings can add to the total value and will be stamped on the extender or mud rings).


If using # 12 wire the multiplier would be 2.25 to give an idea for different wire sizes.
Note that just measuring the box will provide the wrong value. The stamped value is usually smaller than the measured value.