Placing too many wires into an electrical box is difficult, dangerous, and against the National Electrical Code. To avoid possible shorts and overheating due to tightly packed wires, the code limits the number of wires you can put into an electrical box. Wires aren't the only things that count as wires, however.
Each item in your electrical box counts as a different amount of wires. Each insulated wire, all cable clamps combined, all uninsulated wires combined, and each support for light or other fixture count as one wire. Each switch, outlet, or other device counts as two wires. Jumper wires, however, count as zero wires.
The switch box shown has a total of eight "wires" — one for each of the four insulated wires, two for the switch, one for all of the bare ground wires, and one for the cable clamps. The jumper wire does not count as a conductor. You'd need a 3x2x3-1/2-inch device box if you were wiring with 12-gauge wire.
This chart designates the number of conductors allowed in a wiring box based on your box size, the type of box, and the wire size.