What is a module?

A module is a single dark or light cell in a barcode. You can think of a barcode as a row (or grid, for 2D codes) of these cells. A dark module looks like a thin black bar; a light module looks like a thin white space. When several dark modules sit next to each other they form one wide bar; several light modules in a row form a wide space.

1010110001one module
Ten modules in a row. Each cell is exactly one module wide. A 1 is a dark module (bar); a 0 is a light module (space).

The module is the unit every other dimension is measured in. When you read that an EAN-13 barcode is "95 modules wide" or that a Code 128 character is "11 modules of bars and spaces", that is the number of these cells laid out in sequence.

Module vs X-dimension

A module is a count; the X-dimension is a physical width. The module says "this slot exists"; the X-dimension says "this slot is 0.33 mm wide on the label". Same module pattern at different X-dimensions gives you the same barcode at different physical sizes.

Module count

A logical count of cells. 1010110 is seven modules: dark, light, dark, light, dark, dark, light.

X-dimension

The physical width of one module. Typical values: 0.25 mm to 0.50 mm for retail barcodes; smaller for direct part marking; larger for shipping labels.

How modules combine into characters

In a 1D linear barcode each printed character is a fixed number of modules. The exact count depends on the symbology :

SymbologyModules per characterWorked example
EAN-13 7Digit 5 as an L-code = 0110001
Code 128 11 (always 6 bars + 5 spaces)Stop pattern is 13 modules - the only exception
Code 39 13 (9 elements + 1 inter-character gap, mix of narrow/wide)Variable length depending on wide-to-narrow ratio

Modules in 2D codes

In a 2D barcode the modules form a grid rather than a row. A QR code is a square of modules; a Data Matrix symbol is a (usually square) matrix; an Aztec code is a square with a concentric finder pattern. The exact number of modules per side varies with the version and error-correction level of the symbol - a Version 1 QR code is 21 × 21 modules; a Version 40 QR code is 177 × 177 modules.

What about height-modulated barcodes?

A small family of 1D barcodes (USPS Intelligent Mail, PLANET, POSTNET, Australia Post 4-state) does not encode information in width at all - every bar is the same width, and data is carried in each bar's height. For these, the "module" idea still applies as a width unit, but the meaningful state per bar is one of four heights rather than dark-vs-light. We call those out individually on the Intelligent Mail and PLANET pages.

Why it matters

  • Scanability. If the printer can't lay down a clean module at the chosen X-dimension (think of a thermal-transfer head that's only 8 dots/mm), the bars and spaces will smear together and the barcode won't scan.
  • Density vs size. Narrower modules = a shorter barcode for the same data, but less forgiving of print/scan error. Wider modules = a more reliable scan but a wider label.
  • Capacity planning for 2D. The total module count of a QR or Data Matrix tells you how much data fits before you have to step up to the next version. Each step up adds a fixed ring of modules.

Related