Used by 700,000+ people
Free GS1 DataMatrix barcode generator.
GS1 DataMatrix carries GTIN, batch, expiry date and serial number in one 2D code on medicine packs and medical devices. Type the element strings; the generator adds the first FNC1.
How to create a GS1 DataMatrix barcode
-
01
Collect GTIN and production data
Take the GTIN from your item master and batch, expiry date and serial number from production. Under (01), pad the GTIN to 14 digits with zeros in front; the generator does not verify its check digit.
-
02
Type the element strings
Write each AI and its value without parentheses:
01+ GTIN,17+ YYMMDD,10+ batch,21+ serial number. If another AI follows a field without a predefined length, such as the batch, type\Fbetween them. -
03
Size it for your printer
Enter your printer's resolution and a module width of whole dots within your application's GS1 range, such as 0.508 mm (6 dots) at 300 dpi. Add a one-module quiet zone, here 0.508 mm, then download PNG, or SVG with a plan.
What is GS1 DataMatrix?
GS1 DataMatrix is a Data Matrix ECC 200 (Error Checking and Correction) symbol that starts with the Function 1 character (FNC1). It holds GS1 element strings, each an Application Identifier (AI) plus data, so one symbol carries the GTIN (Global Trade Item Number) with batch, expiry date and serial number. GS1 lists it among the preferred carriers for healthcare primary and secondary packs, next to GS1-128 and GS1 DataBar. It is the only GS1 carrier approved for marking medical devices directly.
Where GS1 DataMatrix is used
EU prescription medicine packs with safety features carry a unique identifier (product code, randomised serial number, batch and expiry date) in a Data Matrix, such as GS1 DataMatrix. Pharmacies verify and decommission it at dispensing. Under the U.S. Drug Supply Chain Security Act (DSCSA), prescription drug packages carry their serialised product identifier in a 2D data matrix.
Medical device labels show the UDI (Unique Device Identifier) in plain text and machine-readable form; reprocessed reusable devices carry it on the device itself. Dot peening and laser etching mark GS1 DataMatrix on metal parts, implants and circuit boards. At checkouts, it may accompany the EAN or UPC barcode during GS1's move to 2D.
One scan for GTIN and attributes, at GS1 size and grade
GS1 recommends putting any data required with the GTIN into the same symbol, so one scan reads all of it. The ]d2 prefix lets software tell GS1 data from other Data Matrix content.
The drawing shows the example at 0.495 mm per module, GS1's target for medicine packs not scanned in general distribution. That gives 10.89 mm, or 11.88 mm with the quiet zone. Print growth lowers the grade and a quiet zone under one module fails; aim for 1.5 or better on an ISO/IEC 15415 verifier.
Formats, serial-number batches and automation
Download PNG, GIF or JPG for free; SVG and higher print resolutions come with a plan. For serial numbers, sign in for free and link a data sheet: its rows download as codes in one go. Without an account, the generator makes one code at a time. \F becomes FNC1 in every file.
TBarCode SDK builds GS1 DataMatrix into .NET, C++ and COM applications, royalty-free at runtime. Barcode Studio generates serial-number sequences or imports CSV files and exports them in one run; TBarCode/SAPwin prints them from SAPscript and Smart Forms. In TEC-IT's software, the GS1 code format adds the first FNC1; switch on escape sequences to use \F.
GS1 DataMatrix at a glance
- Type
- Data Matrix ECC 200 with FNC1 first
- Specification
- ISO/IEC 16022; GS1 General Specifications, section 5.6 (Release 26.0, 2026)
- Data
- GS1 element strings, 82-character GS1 set, no spaces
- Capacity
- Up to 3,114 digits or 2,334 alphanumeric characters
- Symbol sizes
- 24 squares from 10 × 10 to 144 × 144 modules, 6 rectangles up to 16 × 48
- Error correction
- Reed-Solomon, fixed per symbol size
- Quiet zone
- One module (1X) on every side
- Number issuer
- GS1 Member Organisations (GS1 Company Prefix)
- X-dimension
- Set per application, e.g. 0.396–0.990 mm on medicine packs not scanned in general distribution
- Print quality
- ISO/IEC 15415 grade 1.5 or better in healthcare, retail and logistics
What the example encodes
(01) and (17) have a predefined length; batch (10) does not, so FNC1 ends it before the serial number (21), which comes last and needs none.
| AI | Content | Format | In the example |
|---|---|---|---|
| (01) | GTIN | 14 digits | 09521234567899 |
| (17) | Expiration date | YYMMDD | 281130: 30 November 2028 |
| (10) | Batch or lot number | Up to 20 characters | ABCD1234, ended by FNC1 |
| (21) | Serial number | Up to 20 characters | 7654 |
Each digit pair, letter or FNC1 takes one codeword: 24 in all. A 20 × 20 symbol holds only 22, so the example is 22 × 22.
A scanner sends ]d201095212345678991728113010ABCD1234, the control character GS (ASCII 29) for the second FNC1, then 217654.
EU and U.S. identification rules for medicines and medical devices
| Rule | Applies to | Encoded data | Barcode |
|---|---|---|---|
| EU Delegated Regulation 2016/161 (since 9 February 2019; in some member states by 2025 at the latest) | Prescription medicines with safety features | Product code, randomised serial number (up to 20 characters), batch, expiry date, national number if required | Data Matrix with ECC 200-level error correction; coding scheme e.g. per ISO/IEC 15418 (GS1 AIs or data identifiers) |
| U.S. DSCSA (21 U.S.C. 360eee-1) | Prescription drug packages | National Drug Code plus serial number (up to 20 characters), lot, expiry date | 2D data matrix |
| U.S. UDI rule (21 CFR 801, 830) | Medical device labels and packages | Device identifier plus lot, serial number, expiry or manufacturing date if on the label | Plain text and AIDC (automatic identification and data capture) |
| EU Medical Device Regulation 2017/745, Annex VI | Medical devices and higher packaging levels | UDI-DI (device identifier) plus UDI-PI (production identifier), e.g. serial number, lot, dates | AIDC and human-readable text |
None of them names GS1 alone. The U.S. Food and Drug Administration accredits GS1, HIBCC and ICCBBA as UDI issuing agencies; the EU has designated these and Germany's IFA until 27 June 2029.
Before you print: module size, text and checks
GS1 sets the X-dimension (module size) per application; larger modules scan and print more reliably.
| Application (GS1 table) | X-dimension (target) | Minimum quality |
|---|---|---|
| Healthcare retail items not scanned in general distribution, e.g. medicine packs (10) | 0.396–0.990 mm (0.495 mm) | 1.5/08/660 |
| Non-retail healthcare items, e.g. hospital primary packs (6) | 0.254–0.990 mm (0.380 mm) | 1.5/08/660 |
| Healthcare items also scanned in general distribution (8) | 0.750–1.520 mm (0.750 mm) | 1.5/20/660 |
| Retail checkout, next to EAN or UPC (1, addendum 2) | 0.396–0.990 mm (0.495 mm) | 1.5/12/660 |
| Direct part marking, except medical devices (7) | 0.254–0.615 mm (0.300 mm) | 1.5/06/660 |
- Quiet zone: the image ends at the symbol edge; keep one module clear on all sides, in the layout or generator.
- Text: the image has none. Print each element string with its AI in parentheses, e.g. (17) 281130, without FNC1; on crowded healthcare items, the GTIN comes first. EU medicine packs print product code and serial number as text unless their two longest dimensions total 10 cm or less.
- Surface: dark on a light, matte background; gold or silver inks and shiny foil can blind scanners. EU medicine packs need a smooth, uniform, low-reflecting surface.
- Verification: an ISO/IEC 15415 verifier reports grade, aperture and light, such as 1.5/08/660; your own scanner only gives a go/no-go result.
Common GS1 DataMatrix input mistakes
- Typed parentheses.
(01)becomes four data characters, so the data no longer starts with an AI. Type01. \Fat the start. The generator already sets FNC1 first; a typed one adds a second before the first AI. Start with the AI.- No separator after the batch.
10ABCD1234217654reads as one batch, ABCD1234217654, with no serial number. Type\Fbefore21. - 00 as the expiry day. Since 1 January 2025, regulated healthcare products need a real day: the end of July 2027 is
270731, not270700.
GS1 DataMatrix compared with related codes
The same ECC 200 symbol without FNC1 in front, for any text that is not GS1 element strings.
Turns GTIN and attributes into a web address for phones, carried by a plain Data Matrix (]d1) or a QR Code.
Same element strings, but with a four-module quiet zone. For direct marking of regulated healthcare items, GS1 approves only GS1 DataMatrix.
Linear carrier of the same AIs, mandatory for the SSCC (Serial Shipping Container Code) unless the logistic unit is too small for an A6 label. A GS1 DataMatrix added to a logistic label repeats all its element strings.
A national pharmaceutical number inside the GTIN pool, such as a German PZN (Pharmazentralnummer) under prefix 4150, encoded under (01) like a GTIN.
The IFA's Pharmacy Product Number code: a Data Matrix with format 06, field identifiers and GS separators instead of FNC1 and AIs.
Frequently asked questions
Learn more about GS1 DataMatrix.
Which AIs does a medicine pack's GS1 DataMatrix need?
Do I have to switch on Escape sequences for \F?
\F into FNC1 with or without the option, in single codes and in batch downloads.
Can a GS1 DataMatrix replace the EAN-13 at the checkout?
What size is a GS1 DataMatrix with GTIN and serial number?
More resources
Data Matrix (ECC200) - 2D Barcode
Data Matrix is a two-dimensional matrix barcode, which encodes text or raw data in a pattern of black and white square modules. Usual data size is from a few…
GuideGS1 Application Identifier (AI)
Barcodes in the GS1 system (like GS1-128 ) use Application Identifiers (AIs) to provide information about the structure of the encoded data. An Application…
FAQHealthcare & Pharma Labeling FAQ
The unique identifier must be a GS1 DataMatrix with a minimum print quality grade of 1.5 measured per ISO/IEC 15415. Below that, packs risk failing…
ProductTBarCode SDK
The developer package for Windows: .NET, OCX and DLL components generate and print 100+ barcode symbologies from your applications.
ProductBarcode Studio
100+ barcode types, a live quality check and batch export.
ProductTBarCode/SAPwin
The Barcode DLL for SAP: print barcodes from SAPscript, Smart Forms and ABAP on almost every printer – via SAPSprint, SAPGUI or WWI.