Free Data Matrix Generator - Compact 2D Barcode
Generate a Data Matrix code for small product labels where a standard barcode would be too large.
0/2335 characters · Supports text, numbers, and binary data
Find this tool useful? Save it for next time.
How to generate a Data Matrix code
Enter the text or data you want to encode, then click Generate. The symbol size is selected automatically based on the amount of data - shorter inputs produce smaller symbols. Download the result as an SVG for professional print workflows or as a high-resolution PNG for documents and digital use.
Data Matrix is well suited for serial numbers, lot codes, tracking identifiers, and any application where space is at a premium. For consumer-facing codes meant to be scanned with a smartphone, a QR code is typically a better choice due to wider device support.
Why Data Matrix for small labels
The key advantage of Data Matrix over other barcode formats is its compactness. A Data Matrix symbol can be scaled down to a few millimetres on each side while still encoding enough data for a complete product identifier. This makes it the dominant format in direct part marking, where the code is permanently etched or engraved onto a component with no room for a label.
The square format also helps when label space is not rectangular. A Data Matrix code can be placed in locations that would be impractical for a linear barcode.
Printing and scanning tips
- Download SVG for print - it scales without quality loss to any physical size
- Use a minimum cell size of 0.38 mm for label printing with handheld scanners
- Maintain a quiet zone of at least one module width on all four sides
- Black on white provides the best contrast - test coloured combinations before production
- For DPM applications, validate the scanning distance and angle with the intended reader
Frequently asked questions
What is a Data Matrix code?
Data Matrix is a two-dimensional matrix barcode that encodes data as a pattern of black and white square cells arranged in a square or rectangular grid. It was developed in 1987 and standardised under ISO/IEC 16022. It is widely used in electronics, aerospace, pharmaceuticals, and food manufacturing, particularly for marking very small components where a standard barcode would be too large.
How much data can a Data Matrix code hold?
A Data Matrix code can hold up to 2,335 alphanumeric characters or 3,116 numeric characters in its maximum size. Unlike QR codes which have discrete versions, Data Matrix automatically selects the smallest symbol size that fits the data, making it very compact for short strings. A serial number of 12 characters can be encoded in a symbol as small as 10 × 10 modules.
What is the difference between Data Matrix and QR code?
Both are 2D matrix codes, but Data Matrix is generally used in industrial and manufacturing contexts while QR codes are more common in consumer applications. Data Matrix produces smaller symbols for the same data content, making it better for marking small components. QR codes support more data capacity at the upper end, built-in error correction level selection, and are more universally supported by consumer smartphone cameras. Most industrial barcode scanners read both.
Can smartphones scan Data Matrix codes?
Most modern smartphones can scan Data Matrix codes using the built-in camera app or a dedicated scanner app. iOS 15 and later can scan Data Matrix natively. Android support varies by manufacturer. Dedicated apps such as Scandit, Cognex Mobile Barcode Scanner, and many others reliably read Data Matrix. In consumer contexts where universal smartphone compatibility is required, QR codes are a safer choice.
What industries use Data Matrix codes?
Data Matrix is the dominant format for direct part marking (DPM) in aerospace and automotive manufacturing, where it is etched or stamped directly onto metal components. It is used in electronics manufacturing for PCB component identification, in pharmaceuticals for unit-of-use labelling under GS1 DataMatrix standards, in food packaging for traceability, and in the US military under the MIL-STD-130 marking standard.
What is the minimum size for a Data Matrix code?
Data Matrix modules can be printed as small as 0.18 mm in industrial DPM applications with high-resolution laser marking. For standard printing such as inkjet or laser printers, the practical minimum cell size is around 0.25 mm, giving a 10 × 10 symbol a printed size of approximately 2.5 × 2.5 mm. For reliable scanning with general-purpose scanners, 0.38 mm cell size or larger is recommended.
Does Data Matrix have error correction?
Yes. Data Matrix uses Reed-Solomon error correction, the same algorithm used in QR codes. The error correction level is determined automatically by the symbol size and cannot be set independently as it can with QR codes. Typically, Data Matrix can recover from approximately 25–33% module damage or obstruction depending on the symbol size used.
Can I use this tool for GS1 DataMatrix codes used in pharma?
GS1 DataMatrix is a specific use of Data Matrix that encodes data using GS1 Application Identifiers (AIs) - the same structured format used in GS1-128 barcodes. This tool generates standard Data Matrix codes. To generate a GS1-compliant DataMatrix for pharmaceutical serialisation, you would need to structure the input data using the correct AIs (such as 01 for GTIN, 17 for expiry, 10 for lot number) in the GS1 element string format.
Related Tools
EAN-13 Barcode Generator
Generate a standards-compliant EAN-13 barcode for retail product labels. Download as SVG or PNG.
PDF417 Generator
Generate a PDF417 barcode for boarding passes, ID documents, and applications requiring dense data encoding.
Code 128 Barcode Generator
Generate a Code 128 barcode for shipping labels, inventory tracking, and internal operations.