You will see stems classified as standard(26.4mm) or oversized(31.8). This refers to the diameter of the handlebar clamp. Which type you need depends on the diameter of your handlebars and is usually clearly marked on the bars. The two sizes are not interconvertable and cannot be shimmed. Virtually all carbonfibre bars are now available in oversize only.
Stem lengths are measured center-to-center, the center of the steerer to the center of the handlebar clasp. They are always measured in mm.