How to create a Data Matrix code
- Choose the barcode typeData Matrix for general use, GS1 DataMatrix for healthcare and retail data, PDF417 for IDs and shipping, Aztec for tickets.
- Enter your dataA serial number, a URL or GS1 data with application identifiers in brackets, such as (01) for the GTIN and (17) for the expiry date.
- Pick a module size and colorsKeep dark modules on a light background and leave the quiet zone on.
- Download PNG or SVGUse SVG for label software and print shops; test a printed sample with your scanner.
What is a Data Matrix code?
A Data Matrix is a square 2D barcode made of black and white modules, with a solid "L" along two edges and a dotted pattern along the other two. It can store a lot of data in a tiny space: a code 2 × 2 mm across can hold a serial number, which is why it's used to mark electronic components, surgical instruments, car parts and medicine packs. It also keeps working when part of it is damaged, thanks to Reed-Solomon error correction.
Unlike a QR code, a Data Matrix is mostly read by industrial scanners and dedicated apps. Many phone cameras ignore it, so use a QR code when ordinary people should scan it with their phone.
Which 2D barcode should you use?
| Type | Shape | Typical use | Read by phone camera? |
|---|---|---|---|
| Data Matrix | Square or rectangle | Parts marking, electronics, small labels | Some apps |
| GS1 DataMatrix | Square | Medicines (EU FMD, US DSCSA), medical devices, retail | Pharmacy and retail scanners |
| PDF417 | Wide rectangle | Driver's licenses, ID cards, boarding passes, shipping labels | Some apps |
| Aztec | Square with a bullseye | Train and airline tickets, mobile boarding passes | Some apps |
| QR code | Square with three corner squares | Marketing, links, WiFi, payments | Yes, every phone |
GS1 DataMatrix: how to format the data
GS1 DataMatrix encodes standard application identifiers (AIs) so that every scanner in the supply chain understands the data. Write each AI in brackets, followed by its value:
| AI | Meaning | Example |
|---|---|---|
| (01) | GTIN, the product number (14 digits) | (01)09501101530003 |
| (17) | Expiry date, YYMMDD | (17)271231 |
| (10) | Batch or lot number | (10)LOT42A |
| (21) | Serial number | (21)A1B2C3D4 |
A full example is (01)09501101530003(17)271231(10)LOT42A(21)XYZ123. The generator checks the format and tells you if an AI or a value is wrong, for example a GTIN with a bad check digit. The GTIN must be one licensed to your company by GS1.
Size and printing tips
- Module size: for labels printed on a standard office or thermal printer, a module of at least 0.33 mm (about 13 mil) is safe. Choose "Large" if you are unsure.
- Quiet zone: keep one empty module around a Data Matrix and two around PDF417. The quiet zone option adds it for you.
- Contrast: black on white is best. Laser-etched parts work too, as long as the marks are clearly darker or lighter than the surface.
- SVG for labels: label design software (BarTender, NiceLabel, Illustrator) imports the SVG and keeps it perfectly sharp.
Privacy
Everything is generated in your browser. Serial numbers, patient data or ticket codes never leave your computer.
Frequently asked questions
Is this Data Matrix generator free?
Yes. Data Matrix, GS1 DataMatrix, PDF417 and Aztec codes are free to create and download, with no sign-up and no watermark.
Can a phone scan a Data Matrix code?
Some phone cameras and many scanner apps can, but not all. For codes the public will scan, use a QR code instead.
What is the difference between Data Matrix and GS1 DataMatrix?
GS1 DataMatrix is a Data Matrix that follows GS1 rules: it starts with a special FNC1 character and contains application identifiers such as (01) GTIN and (17) expiry date.
How much data can a Data Matrix hold?
Up to 2,335 letters and digits or 3,116 digits in the largest size. Small codes for parts marking usually hold 10 to 50 characters.
Which format do I need for medicine packs?
GS1 DataMatrix with the GTIN (01), expiry (17), lot (10) and serial number (21), as required by the EU Falsified Medicines Directive and similar rules.
Can I download a vector file?
Yes. The SVG download is a vector file that stays sharp at any size and imports into label and design software.
Related free tools
Related guides
Was this page helpful?
Last updated October 27, 2026 by the QR Code Haven team. Found a problem? Tell us.
Coming soon: Pro — dynamic QR codes Waitlist
Edit where a code points after you print it, and see scan analytics (time, city, device). Your free static codes here stay free and keep working forever — Pro is an optional extra.
No spam. One email when Pro launches. Contact: hello@qrcodehaven.in