Data Matrix Code Generator
Make a Data Matrix code for a serial number, part label, or GS1 product pack. Type your content, set the size and colors, and download the code as a PNG or SVG. It is made in your browser.
1. Code type and content
Any text, numbers, or a link. Up to 3,116 digits or 2,335 letters and numbers.
Uses a rectangle when it is smaller than the square, for narrow labels. Some of the longer rectangle sizes are newer and are not read by older scanners.
For medicine, medical device, and retail packs that follow GS1 rules. Leave it off for your own labels.
2. Size
Size of one square. Raise it for a larger, sharper PNG.
3. Colors
Loading the barcode maker…
Print a test copy and scan it before you print a full batch.
What is a Data Matrix code?
A Data Matrix code is a 2D barcode made of small dark and light squares, called modules, arranged in a square or rectangle. It can hold text, numbers, or a link, and it fits a lot of data into very little space, which is why it is printed or etched on small parts and medicine packs.
You can spot one by its border. Two sides are solid lines that form an L, which shows the scanner where the code is and which way up it is. The other two sides alternate dark and light, which tells the scanner how many rows and columns there are. Error correction is built in, so a scratched or smudged code can still scan.
Why use our Data Matrix generator
- ·Smallest size that fits. The tool picks the size for you and shows it under the preview.
- ·GS1 Data Matrix. Type fields like (01) and (17), and the tool checks the product number's check digit.
- ·Sharp files. The SVG scales to any size, and the PNG uses whole pixels for every module so edges stay crisp.
- ·Readability warnings. You are told when colors or the margin could stop the code from scanning.
- ·Free and private. No account, no watermark, and your data stays on your device.
How to make a Data Matrix code
- 1
Type your content
Enter a serial number, part number, link, or any text. Turn on GS1 Data Matrix if you are coding a medicine, medical device, or retail pack.
- 2
Choose the shape
Leave it on square, which every Data Matrix scanner reads. Allow rectangle shapes only if the code has to fit a narrow strip.
- 3
Set the size and margin
Pick a module size your printer can print cleanly and keep at least 1 module of blank margin around the code.
- 4
Download and test
Download a PNG or SVG, print one copy at its final size, and scan it with the scanner you plan to use.
Data Matrix sizes and how much they hold
A square Data Matrix comes in fixed sizes from 10 × 10 to 144 × 144 modules. The tool always uses the smallest one your content fits in. Digits pack more tightly than letters, so a number makes a smaller code than text of the same length. The table shows a selection of sizes, not counting the margin.
| Size (modules) | Digits only | Letters and numbers |
|---|---|---|
| 10 × 10 | 6 | 3 |
| 12 × 12 | 10 | 6 |
| 14 × 14 | 16 | 10 |
| 16 × 16 | 24 | 16 |
| 18 × 18 | 36 | 25 |
| 20 × 20 | 44 | 31 |
| 22 × 22 | 60 | 43 |
| 24 × 24 | 72 | 52 |
| 26 × 26 | 88 | 64 |
| 32 × 32 | 124 | 91 |
| 40 × 40 | 228 | 169 |
| 48 × 48 | 348 | 259 |
| 64 × 64 | 560 | 418 |
| 88 × 88 | 1,152 | 862 |
| 120 × 120 | 2,100 | 1,573 |
| 144 × 144 | 3,116 | 2,335 |
To work out the printed size, multiply the modules by the size of one module. An 18 × 18 code printed with 0.5 mm modules is 9 mm wide, plus the margin on each side.
How to enter data for a GS1 Data Matrix
A GS1 Data Matrix stores data in numbered fields called application identifiers. Type each field number in brackets, then its value, with no spaces. For example, (01)09506000134352(17)271231(10)AB12 holds a product number, an expiry date of 31 December 2027, and batch AB12. These are the fields used most often:
| Field | What it holds | Format |
|---|---|---|
| (01) | Product number (GTIN) | 14 digits |
| (17) | Expiry date | 6 digits, YYMMDD |
| (11) | Production date | 6 digits, YYMMDD |
| (10) | Batch or lot number | Up to 20 characters |
| (21) | Serial number | Up to 20 characters |
- ·The brackets are not stored in the code. They only show where each field starts, and scanners print them back the same way.
- ·The tool adds the separator characters GS1 needs after fields like (10) that can vary in length, so you do not type them.
- ·The product number in (01) must be a real GTIN from GS1 for goods sold in stores or pharmacies. The tool checks its check digit but cannot check that the number is registered to you, and it does not check that dates are real dates.
Data Matrix or QR code: which to use
- ·Data Matrix is smaller for short data. The serial number SN-2026-000481 makes a 16 × 16 Data Matrix, while the smallest standard QR code is 21 × 21. A Data Matrix also needs only 1 module of margin, where a QR code needs 4.
- ·QR codes work with phone cameras. For a link that customers should open, use the QR code generator.
- ·Follow the system you are labeling for. If a customer, regulator, or scanner asks for Data Matrix or GS1 Data Matrix, use it. A QR code holding the same data will not be accepted.
Who uses Data Matrix codes
- ·Electronics makers. Mark circuit boards and small components with a serial or part number in a code only a few millimeters wide.
- ·Medicine makers and pharmacies. Prescription medicine packs sold in the EU carry a GS1 Data Matrix with the product number, serial number, batch, and expiry date, so each pack can be checked before it is handed out.
- ·Medical device makers. Put the device identifier and production details on small labels and packs in GS1 format.
- ·Factories and repair shops. Track parts through production and service with a code that still scans when it is partly worn.
- ·Labs. Label sample tubes, slides, and plates, where there is little room for a longer barcode.
Data Matrix code FAQ
- What is a Data Matrix code used for?
- It is used where a code has to be small: serial numbers on electronic parts, medicine and medical device packs, lab samples, and parts tracked through a factory. It holds much more than a regular barcode in the same space.
- How much can a Data Matrix code hold?
- The largest square, 144 × 144 modules, holds up to 3,116 digits or 2,335 letters and numbers. Other characters take more room, about 1,550 at most. The tool picks the smallest size that fits, so short content makes a small code.
- How do I make a GS1 Data Matrix?
- Turn on GS1 Data Matrix and type each field number in brackets followed by its value, like (01)09506000134352(17)271231(10)AB12. The tool adds the separators GS1 needs and checks the check digit of the (01) product number. It does not check that dates are real dates.
- Should I choose a square or a rectangle?
- Use a square unless the code must fit a narrow space. Every Data Matrix scanner reads the square sizes. Some of the longer rectangle sizes were added to the standard later, and older scanners do not read them.
- Why won't my Data Matrix code scan?
- The usual causes are a missing margin, colors that are too close together, or modules too small for the printer to print cleanly. A scanner set up for GS1 data may also reject a plain code, and the other way around. Print a test at the final size and check the warnings under the preview.
- Does a Data Matrix code have error correction?
- Yes. Every Data Matrix uses Reed-Solomon error correction, so it can still scan when part of it is damaged. Unlike QR and Aztec codes, the amount is set by the size of the code, so there is no level to choose.
- Can a phone scan a Data Matrix code?
- Yes, with a barcode scanner app. Built-in phone camera apps are made for QR codes, so if people should open a link with their phones, make a QR code instead.
- Can a Data Matrix code hold accented letters or emoji?
- Yes. Accented letters used in Western European languages fit the code's standard character set. Other characters, such as emoji or Cyrillic, are stored as UTF-8 with a marker that tells the scanner. Some older scanners ignore that marker and show the wrong characters.
- Is my data uploaded?
- No. The code is made in your browser, and nothing you type leaves your device.