Basic Practice of 2D Codes 2D Code Implementation and Marking Size

Calculating the module size is as important as determining the data content. The module size is important for determining the reading allowance and selecting the code reader and printer or marker. The size of the quiet zone and the number of modules on one side of the code are important for determining the module size.

2D Codes and How They Differ from Barcodes

Barcodes have been used in various fields around the world from POS systems in supermarkets and convenience stores to production instructions in the manufacturing industry and order management between companies.

As barcodes became widespread, their convenience became widely recognized, and the needs for even greater convenience grew. Businesses wanted barcodes to have more information and carry all the information of an order slip. They wanted barcodes to be smaller and be able to be placed on electronic components.

From these demands, the 2D code was born. A 2D code can hold several hundred times more information than a barcode at one-tenth or less the size.

These advantageous characteristics have led to expanding applications in various fields.

Large data recording capacity

Whereas a barcode contains information in only one direction, a 2D code contains information in both the vertical and horizontal directions, enabling coding of several hundred times more data than a barcode.

Barcode2D code
Multiple digit code
32-digit barcode
7089-digit 2D code

High data density

2D codes can hold the same amount of information as a barcode in a smaller size.

Comparison of the code size for 26-digit data: a long barcode versus two much smaller 2D codes (QR code and DataMatrix) of the same narrow bar / module width

* The narrow bar width of a barcode and the 2D code module size are the same size.

Error correction (data restoration) capability

2D codes have a function to enable restoration of data if the code is damaged or smudged, allowing data restoration and reading even if up to 30% of the code is damaged.

Data restoration uses the Reed-Solomon mathematical error detection and correction method to restore data and prevent incorrect reading (reading of incorrect data).

  • Spot
  • Stain
  • Damaged

Representative 2D Codes

QR codes

QR codes are classified into Model 1 and Model 2, which have three position detection patterns, and Micro QR, which has just one position detection pattern. The size of the quiet zones required in a QR code is four modules wide (two modules wide for a micro QR code).

DataMatrix ECC200

There are two types of DataMatrix (ECC200) codes: a square configuration and a rectangular configuration. The size of the quiet zones required in a DataMatrix code is one module wide.

Square DataMatrix code wrapped around a cylindrical workpiece: marking not possible. Rectangular DataMatrix code with the same data marks correctly and suits limited marking space or cylinders

Determining the Marking Data and Managing the Data Content

The first step to implementing a 2D code is to organize the data content. Organize the number of data items you want to manage. Let us use the following as an example.

Example of managed items

  • Product No.: P123456
  • Lot No.: 00219
  • Serial No.: 0005365
  • Manufacture date: 19/12/22
  • Quantity: 100
  • Location No.: 001
  • etc.

The data format can be determined by clarifying the data (data to be included in the 2D code) to be managed.

Data Format

The next step is to determine the data format.

Careful consideration is required, as these items will determine the applications that can handle the data and the 2D code marking size.

Number of digits of the data items

The number of data digits (data length) can be expressed in “variable length”, where the number of digits changes, and “fixed length”, where the number of digits is a constant.

Careful consideration is required, as the method of expression determines the data processing method and the size and content of the 2D code.

Separating variable-length data

Because the number of data digits varies, if the variable-length data continues or exists in the data, a character (separator) indicating the delimiter of the variable-length data is required.

(Three items of variable-length data (blue, red, green))

Without a separator

12345ABCD9876

963ZYX877123654

There is no information indicating where to separate the variable-length data, so the computer cannot determine where to separate the data.

With a separator

12345 : ABCD : 9876

963 : ZYX877 : 123654

Here, a colon (:) is used as a separator. The separator makes it easy to see where to separate the data, so the computer can recognize three sets of data.

(The separator processing must be constructed on the computer.)

Effect of the variable-length data

The 2D code is generally created to be the smallest size possible. Therefore, if there is variable-length data, the size of the 2D code varies depending on the data content. If the marking area is limited, it is necessary to check the specifications of the 2D code with the maximum number of digits expected.

When non-numeric characters are included in the data

2D codes compress data to enable marking in a small space. However, because the compression method differs depending on the character type, number of characters and character order, the code size may change even though the number of data digits is the same.

Comparison of 2D codes using alphabetic and numeric characters: 41 digits of numeric characters only versus 40 digits with 1 alphabetic character produce QR codes of different sizes.

Four character expression modes of 2D codes

There are four character expression modes for 2D codes.

Each mode has different set of characters that can be expressed and a compression rate, and the modes are combined to create the smallest code size possible when creating a code.

  • Numeric mode

    Only numeric characters can be expressed.

    This is effective when there are two or more numeric characters in a row.

    This has the feature of reducing the amount of information per character.

  • Alphanumeric mode

    Alphanumeric characters and some symbols can be expressed.

    The amount of information per character is greater than numeric mode but smaller than binary mode.

  • Binary mode

    All single-byte characters (control code, etc.) can be expressed.

    The amount of information per character is greater than alphanumeric mode, and control codes can be expressed.

  • Kanji mode

    Double-byte characters, such as kanji, can be expressed.

    The amount of information per character is the greatest of the four modes.

Calculating the Module Size

Module size

The smallest element (black or white square) of the 2D code is called a “module”.

The module size is the length of one module.

Zoomed-in view of a 2D code pattern, with an arrow marking the module size: the length of one module from edge to edge

When the marking area for a 2D code is provided, use the following formula to calculate the module size.

Number of modules in 1 direction = Number of modules on 1 side + (number of quiet zone modules) × 2

Module size = Length on 1 side ÷ number of modules in 1 direction

Example: When a marking area of 30 mm × 30 mm 1.18″ × 1.18″ is provided

QR code

Calculate the module size using the number of modules on one side of the code and a quiet zone of four modules.

QR code diagram labeled quiet zone, number of modules per side, quiet zone: the quiet zone runs along both sides of the code

21 modules + 4 modules × 2 = 29 modules

30 mm 1.18″ ÷ 29 modules ≈ 1.03 mm/module 0.04″/module

DataMatrix

Calculate the module size using the number of modules on one side of the code and a quiet zone of one module.

DataMatrix diagram labeled quiet zone, number of modules per side, quiet zone: the quiet zone runs along both sides of the code

10 modules + 1 module × 2 = 12 modules

30 mm 1.18″ ÷ 12 modules ≈ 2.5 mm/module 0.10″/module

By determining the marking data and code size and marking area, it is possible to calculate the markable module size. Select the code reader and printer or marker based on the module size.

Maximum Number of Input Characters

QR code

Model 2

Version
(number of modules)
NumericAlphanumericBinaryKanji
LMQHLMQHLMQHLMQH
1 (21)4134271725201610171411710874
2 (25)7763483447382920322620142016128
3 (29)1271017758776147355342322432262015
4 (33)187149111821149067507862463448382821
5 (37)255202144106154122876410684604465523727
6 (41)32225517813919515410884134106745882654536
7 (45)37029320715422417812593154122866495755339
8 (49)46136525920227922115712219215210884118936652
9 (53)552432312235335262189143230180130981411118060
10 (57)6525133642883953112211742712131511191671319374
11 (61)77260442733146836625920032125117713719815510985
12 (65)88369148937453541929622736728720315522617712596
13 (69)1022796580427619483352259425331241177262204149109
14 (73)1101871621468667528376283458362258194282223159120
15 (77)1250991703530758600426321520412292220320254180136
16 (81)14081082775602854656470365586450322250361277198154
17 (85)15481212876674938734531408644504364280397310224173
18 (89)172513469487461046816574452718560394310442345243191
19 (93)1903150010638131153909644493792624442338488384272208
20 (97)2061160011599191249970702557858666482382528410297235
21 (101)22321708122496913521035742587929711509403572438314248
22 (105)2409187213581056146011348236401003779565439618480348270

Micro QR

Version
(number of modules)
Error correctionNumericAlphanumericBinaryKanji
M1 (11)—5———
M2 (13)L106——
M85——
M3 (15)L231496
M181174
M4 (17)L3521159
M3018138
Q211395

Error correction level of QR code and micro QR

Error correction levelDamaged area to entire code size
L7%
M15%
Q25%
H30%

Note

The characters in the table above are the maximum number of characters that can be entered. However, the version (number of modules) can increase depending on the data component (e.g. a combination of figures and symbols or a combination of upper and lower case alphabetic characters), even when the data contains less characters than indicated in the table above.

DataMatrix ECC200

Square type

Number of modulesData capacityError correction rate
NumericAlphanumericBinary
10 × 10 modules63125%
12 × 12 modules106325%
14 × 14 modules1610628 to 39%
16 × 16 modules24161025 to 38%
18 × 18 modules36251622 to 34%
20 × 20 modules44312023 to 38%
22 × 22 modules60432820 to 34%
24 × 24 modules72523420 to 35%
26 × 26 modules88644219 to 35%
32 × 32 modules124916018 to 34%
36 × 36 modules1721278416 to 30%
40 × 40 modules22816911215 to 28%
44 × 44 modules28821414214 to 27%
48 × 48 modules34825917214 to 27%
52 × 52 modules40830420215 to 27%
64 × 64 modules56041827814 to 27%
72 × 72 modules73655036614 to 26%
80 × 80 modules91268245415 to 28%
88 × 88 modules115286257414 to 27%
96 × 96 modules1392104269414 to 27%
104 × 104 modules1632122281415 to 28%
120 × 120 modules21001573104814 to 27%
132 × 132 modules26081954130214 to 26%
144 × 144 modules31162335155614 to 27%

Rectangular type

Number of modulesData capacityError correction rate
NumericAlphanumericBinary
8 × 18 modules106325%
8 × 32 modules2013824%
12 × 26 modules32221423 to 37%
12 × 36 modules44312023 to 38%
16 × 36 modules64463021 to 38%
16 × 48 modules98724718 to 33%

Note

The characters in the table above are the maximum number of characters that can be entered. However, the version (number of modules) can increase depending on the data component (e.g. a combination of figures and symbols or a combination of upper and lower case alphabetic characters), even when the data contains less characters than indicated in the table above.

Extended rectangular DataMatrix (DMRE)

DMRE

Number of modulesData capacityError correction rate
NumericAlphanumericBinary
8 × 48 modules36251621 to 36%
8 × 64 modules48342221 to 36%
8 × 80 modules64463020 to 35%
8 × 96 modules76553621 to 38%
8 × 120 modules98724720 to 36%
8 × 144 modules126936118 to 34%
12 × 64 modules86634118 to 34%
12 × 88 modules128946218 to 33%
16 × 64 modules124916018 to 34%
20 × 36 modules88644219 to 35%
20 × 44 modules112825419 to 34%
20 × 64 modules1681248217 to 31%
22 × 48 modules1441067017 to 32%
24 × 48 modules1601187817 to 31%
24 × 64 modules21616010615 to 28%
26 × 40 modules1401036818 to 32%
26 × 48 modules1801338816 to 30%
26 × 64 modules23617511615 to 28%

Note

The characters in the table above are the maximum number of characters that can be entered. However, the version (number of modules) can increase depending on the data component (e.g. a combination of figures and symbols or a combination of upper and lower case alphabetic characters), even when the data contains less characters than indicated in the table above.

Contact us to learn more about how our advanced technology can help take your business to the next level.