Dev48
Language
  • About
  • Services
  • Industries
  • Technologies
  • Articles
  • Contacts
Book a call
    Home/Articles/Basic practice of 2d codes 2d code implementation and marking size
Dev48
info@dev48.org+375 29 320-40-96WhatsApp@isky_by

© 2026 · All rights reserved.

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

Фото: Markus Spiske (Unsplash) — https://unsplash.com/photos/javascript-code-on-dark-screen-cvBBO4PzWPg?utm_source=dev48&utm_medium=referral

Source: Keyence•November 26, 2026 at 07:23 AM

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

Determining the marking data content and format, and calculating the module size from the marking area to select the code reader, printer, or marker

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.

High data density

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

* 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).

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.

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.

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))

12345ABCD9876

963ZYX877123654

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

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.)

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.

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.

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.

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.

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.

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.

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.

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.

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

Micro QR

Error correction level of QR code and micro QR

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

Rectangular type

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

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.

← All articles

What this article says

More in Industrial & Industry 4.0

All →
SLA 3D Printing: How It Works and When to Use It
Stratasys

SLA 3D Printing: How It Works and When to Use It

OT Ransomware in 2025: How to Strengthen Security | Rockwell Automation | US
Rockwell Automation

OT Ransomware in 2025: How to Strengthen Security | Rockwell Automation | US

Boost Slag Grinding Throughput and Energy Efficiency | Rockwell Automation | US
Rockwell Automation

Boost Slag Grinding Throughput and Energy Efficiency | Rockwell Automation | US

In-Motion DPMCode Reading
Keyence

In-Motion DPMCode Reading

Measuring Solder and Bump Height and Volume: 100% Quantification With Tilt Correction via Light-Section 3D Profiles
Keyence

Measuring Solder and Bump Height and Volume: 100% Quantification With Tilt Correction via Light-Section 3D Profiles

Battery Manufacturing Measurement Guide: Understand What to Measure in Order of Process
Keyence

Battery Manufacturing Measurement Guide: Understand What to Measure in Order of Process

More from Keyence

In-Motion DPMCode Reading
Keyence

In-Motion DPMCode Reading

Measuring Solder and Bump Height and Volume: 100% Quantification With Tilt Correction via Light-Section 3D Profiles
Keyence

Measuring Solder and Bump Height and Volume: 100% Quantification With Tilt Correction via Light-Section 3D Profiles

Battery Manufacturing Measurement Guide: Understand What to Measure in Order of Process
Keyence

Battery Manufacturing Measurement Guide: Understand What to Measure in Order of Process

3D Detection of Adhesive Bead Defects: Inline 100% Inspection of Discontinuities, Slumping, and Air Bubbles
Keyence

3D Detection of Adhesive Bead Defects: Inline 100% Inspection of Discontinuities, Slumping, and Air Bubbles

What Is a Non-Contact Laser Displacement Sensor? How to Choose for Replacing Contact-Type Instruments/Dial Gauges
Keyence

What Is a Non-Contact Laser Displacement Sensor? How to Choose for Replacing Contact-Type Instruments/Dial Gauges

What Is 3D Laser Profile Measurement? The Principle of Digitizing Cross-Sectional Shapes With Height Data
Keyence

What Is 3D Laser Profile Measurement? The Principle of Digitizing Cross-Sectional Shapes With Height Data