GS1 DataMatrix explained,
with examples

What is inside a GS1 DataMatrix, field by field, and how it differs from a plain Data Matrix.

Updated 10 min read By the Data Matrix Code Generator team

On this page 8 sections
  1. Short answer
  2. Plain vs GS1 DataMatrix
  3. Anatomy of a GS1 element string
  4. Application Identifiers
  5. Three real-format examples
  6. Where it is required
  7. Make or check one
  8. FAQ

The short answer

A GS1 DataMatrix is a Data Matrix ECC 200 code that starts with a special FNC1 character and stores product data as GS1 Application Identifier fields, such as (01) GTIN, (17) expiry date, (10) batch or lot and (21) serial number. Variable-length fields are followed by a group separator unless they are last. The brackets you see in the printed text are not encoded.

Every code, table and byte on this page is generated by the same engine as our GS1 DataMatrix generator, and each example is decoded by an independent reader in our tests. Field formats come from the GS1 Barcode Syntax Dictionary (release 2026-01-27). The rules come from the GS1 General Specifications (Release 26.0, January 2026) and the GS1 DataMatrix Guideline (Release 2.5.1), checked November 2026.

Plain Data Matrix vs GS1 DataMatrix

The squares are the same. Both use Data Matrix ECC 200 from ISO/IEC 16022, with the same sizes and the same error correction. The difference is in the data and the rules around it.

Plain Data Matrix and GS1 DataMatrix compared
Feature Plain Data Matrix GS1 DataMatrix
First character Your data FNC1 (codeword 232)
Content Any text: a part number, a URL, a serial GS1 fields only: AI + value, AI + value…
Who defines the meaning You and the system that reads it GS1, worldwide
Scanner prefix ]d1 ]d2
Needs a GS1 number No Yes for a GTIN, (01)
Typical use Parts, assets, internal tracking Medicines, medical devices, retail food

So a plain code that happens to contain 0109506000134352 is not a GS1 DataMatrix. Without the leading FNC1, a scanner has no way to know the first two digits are an Application Identifier. If you only need your own part or asset numbers, use the plain generator.

Anatomy of a GS1 element string

An element string is one Application Identifier (AI: a 2 to 4 digit number that says what the next value is) followed by its value. A GS1 DataMatrix chains several element strings after one FNC1. Here is a real medicine-pack code, taken apart.

GS1 DataMatrix, 22 by 22 modules, encoding (01)09506000134352(17)280531(10)A1B2C3(21)4K7P9X2M5QNumbered marks: 1 finder pattern (solid L-shaped border on the left and bottom), 2 clock track (alternating squares on the top and right), 3 data area, 4 quiet zone (blank margin).1234
Printed under the code (human readable text)
(01)09506000134352 (17)280531 (10)A1B2C3 (21)4K7P9X2M5Q
Encoded in the symbol
  1. Start character FNC1
  2. AI 01
  3. value 09506000134352
  4. AI 17
  5. value 280531
  6. AI 10
  7. value A1B2C3
  8. Separator, FNC1 GS
  9. AI 21
  10. value 4K7P9X2M5Q
What a scanner sends
  1. Symbology identifier ]d2
  2. AI 01
  3. value 09506000134352
  4. AI 17
  5. value 280531
  6. AI 10
  7. value A1B2C3
  8. Group separator, ASCII 29 <GS>
  9. AI 21
  10. value 4K7P9X2M5Q
The same, as bytes (hex)
5D 64 32 30313039353036303030313334333532313732383035333131304131423243331D3231344B37503958324D3551
  1. Finder pattern. The solid L on the left and bottom edges tells a scanner where the code is and which way up it is.
  2. Clock track. Alternating squares on the top and right edges give the grid size.
  3. Data area. Your data plus Reed-Solomon error correction. This one is 22 × 22 and uses 30 of its 30 data codewords.
  4. Quiet zone. Blank margin, at least 1 module wide on all four sides (we default to 2).
A real GS1 DataMatrix made by our engine and decoded by an independent reader in our tests. The GTIN is GS1's own example number.

Reading it from left to right:

  1. FNC1 first: this is a GS1 code. A scanner turns it into the prefix ]d2 (bytes 5D 64 32).
  2. (01) + 14 digits: the GTIN, the product number. Its length is predefined, so no separator follows.
  3. (17) + 6 digits: expiry date as YYMMDD. 280531 means 31 May 2028. Also predefined, no separator.
  4. (10) + up to 20 characters: the batch. It can be any length, so a GS separator (encoded as FNC1, sent as ASCII 29, hex 1D) marks where it ends.
  5. (21) + up to 20 characters: the serial number. It is the last field, so it needs no separator.

The printed text under the code (the human readable interpretation, or HRI) puts each AI in brackets so a person can key it in if the scan fails. The brackets help people only. They are never encoded, and FNC1 never appears in the printed text.

Field order: fixed lengths first

GS1 gives field order no meaning, but order changes the size. The same four fields with the batch and serial before the expiry date need 2 separators instead of 1. Here that pushes the code from 22 × 22 up to 24 × 24 modules (30 vs 31 data codewords). The GS1 DataMatrix Guideline recommends putting a single variable-length field at the end for exactly this reason. Moving fields never changes what the data says, so put predefined-length fields (GTIN, dates, weights) first.

Fixed length is not the same as predefined length

Only AIs that start with 00, 01, 02, 03, (04), 11, 12, 13, (14), 15, 16, 17, (18), (19), 20, 31, 32, 33, 34, 35, 36 or 41 have a predefined length and can skip the separator. GS1 fixed that list (Table 7-6 in the GS1 General Specifications) when AIs were first introduced and will not change it, so decoders never need updating. No AIs use 04, 14, 18 and 19 yet (the ones in brackets); GS1 keeps them for future predefined-length AIs, so a decoder should include them too. Every other field needs a separator when another field follows, even if its length never varies. For example, (422) country of origin is always 3 digits and still needs one.

Application Identifiers you will meet most

GS1 defines 541 AIs (counting each number in a range). These are the ones most labels use. In the format column, N means digits, X means letters, digits and some punctuation, and .. means “up to”: N14 is exactly 14 digits, X..20 is up to 20 characters.

GS1 Application Identifiers, from the GS1 Barcode Syntax Dictionary release 2026-01-27. “Separator” = needs a GS when another field follows.
AI Meaning Format Separator Example value
(01) Product number (GTIN) N14 14 digits with check digit No 09506000134352
(02) GTIN of the items inside N14 14 digits with check digit No 09506000134352
(00) Serial shipping container code (SSCC) N18 18 digits with check digit No 095060001343520000
(10) Batch or lot number X..20 up to 20 characters Yes A1B2C3
(21) Serial number X..20 up to 20 characters Yes 4K7P9X2M5Q
(11) Production date N6 date YYMMDD (day 00 allowed) No 260915
(13) Packaging date N6 date YYMMDD (day 00 allowed) No 261016
(15) Best before date N6 date YYMMDD (day 00 allowed) No 270630
(16) Sell by date N6 date YYMMDD (day 00 allowed) No 270531
(17) Expiry date N6 date YYMMDD (day 00 allowed) No 280531
(7003) Expiry date and time N6+N4 date YYMMDD + time HHMM Yes 2805312359
(30) Variable count of items N..8 up to 8 digits Yes 24
(37) Count of trade items inside N..8 up to 8 digits Yes 48
(310n) Net weight (kg); n = decimal places, 0 to 5 N6 6 digits No 001250
(400) Customer purchase order number X..30 up to 30 characters Yes PO-77812
(410) Ship to (GLN) N13 13 digits with check digit No 9506000134369
(414) Physical location (GLN) N13 13 digits with check digit No 9506000134369
(422) Country of origin N3 3-digit ISO country code Yes 840
(8004) Individual asset ID (GIAI) X..30 up to 30 characters Yes 9506000134ASSET042
(712) National healthcare number: Spain (CN) X..20 up to 20 characters Yes 654321
(715) National healthcare number: USA (NDC) X..20 up to 20 characters Yes 0123456789

Download all 541 AIs (CSV) with format, length, separator rule and the fields each one needs or excludes. Generated from engine v2.0.1. Free to share; please link back to this page.

Dates are YYMMDD. Day 00 means the last day of that month, in every date field that allows it (for example production 11, best before 15 and expiry 17), but not on regulated healthcare products: since 1 January 2025 GS1 requires the real day there. Some AIs also need a partner: a batch (10) or expiry (17) means nothing without the GTIN (01) of the item, so a validator should reject them alone. Weights put the number of decimals in the last AI digit: (3103) 001250 is 1.250 kg.

Three real-format examples

Each example below is generated by our engine and decoded by an independent reader. The GTINs use GS1's example company prefix, so they belong to no real product. Scan them with your phone or paste a screenshot into the reader to see the same fields.

Example 1

Medicine pack

The four fields EU and US medicine pack rules ask for: product code, expiry, batch and a serial number.

22 × 22 modules · 1 separator · 30 of 30 data codewords

Printed text

(01)09506000134352(17)280531(10)A1B2C3(21)4K7P9X2M5Q

Encoded

  1. Start character FNC1
  2. AI 01
  3. value 09506000134352
  4. AI 17
  5. value 280531
  6. AI 10
  7. value A1B2C3
  8. Separator, FNC1 GS
  9. AI 21
  10. value 4K7P9X2M5Q
AI Field Value
(01) Product number (GTIN) N14 09506000134352
(17) Expiry date N6 280531 = 31 May 2028
(10) Batch or lot number X..20 A1B2C3
(21) Serial number X..20 4K7P9X2M5Q

Example 2

Medical device label

A UDI-style label: the GTIN identifies the device model, the dates, lot and serial identify this unit.

22 × 22 modules · 1 separator · 28 of 30 data codewords

Printed text

(01)09506000134376(11)260915(17)310914(10)LOT2609(21)00042

Encoded

  1. Start character FNC1
  2. AI 01
  3. value 09506000134376
  4. AI 11
  5. value 260915
  6. AI 17
  7. value 310914
  8. AI 10
  9. value LOT2609
  10. Separator, FNC1 GS
  11. AI 21
  12. value 00042
AI Field Value
(01) Product number (GTIN) N14 09506000134376
(11) Production date N6 260915 = 15 Sep 2026
(17) Expiry date N6 310914 = 14 Sep 2031
(10) Batch or lot number X..20 LOT2609
(21) Serial number X..20 00042

Example 3

Fresh food pack

A pack of cheese sold by weight: GTIN, net weight, best before date and batch. No separators at all.

20 × 20 modules · no separators · 22 of 22 data codewords

Printed text

(01)09506000134383(3103)001250(15)261120(10)B2611

Encoded

  1. Start character FNC1
  2. AI 01
  3. value 09506000134383
  4. AI 3103
  5. value 001250
  6. AI 15
  7. value 261120
  8. AI 10
  9. value B2611
AI Field Value
(01) Product number (GTIN) N14 09506000134383
(3103) Net weight (kg), 3 decimal places N6 001250 = 1.250 kg
(15) Best before date N6 261120 = 20 Nov 2026
(10) Batch or lot number X..20 B2611

Example 3 has no separators at all: GTIN, weight and date are predefined lengths, and the one variable field, the batch, is last. That is the ordering advice from above in practice.

Where GS1 DataMatrix is required

These are the best-known uses. The rules belong to regulators and trading partners, and they change. Always check the current text that applies to you; our tools check GS1 syntax, not legal compliance.

  • Medicines in the EU. The Falsified Medicines Directive safety rules (Delegated Regulation (EU) 2016/161) require a Data Matrix on most prescription medicine packs with the product code, serial number, batch and expiry, plus a national reimbursement number in some countries. GS1 DataMatrix is the usual way to meet it.
  • Medicines in the US. The Drug Supply Chain Security Act asks for a product identifier (product code, serial number, lot and expiry) in a 2D Data Matrix on each package. That is the four-field layout of example 1.
  • Medical devices. The FDA's Unique Device Identification (UDI) rule needs a device identifier plus production identifiers in plain text and machine-readable form. GS1 is one of three FDA-accredited issuing agencies, with HIBCC and ICCBBA.
  • Retail. Under GS1 US Sunrise 2027, checkout scanners should read 2D codes by the end of 2027. A 2D code can carry the batch, weight and best-before date that a UPC cannot, as in example 3. UPC barcodes stay.

GS1 Digital Link is a different format

A GS1 Digital Link puts the same keys in a web address, such as https://id.gs1.org/01/09506000134352/10/A1B2C3, usually in a QR code. It is plain text with no FNC1, so it is not an element string. Our GS1 generator refuses Digital Link URLs on purpose; encode them as plain text in the generator if a partner asks for one.

Print quality is graded separately, with an ISO/IEC 15415 verifier. The GS1 DataMatrix Guideline's tables set a minimum grade of 1.5 (C) for most applications. A phone or our reader decoding a code is a good sign, but it is not a verification grade.

Make or check one

  • Make one: the GS1 DataMatrix generator has a guided form for GTIN, dates, batch, serial and more. It computes check digits, adds FNC1 and separators, and shows the printed text apart from the encoded data. It says “Supported GS1 fields passed syntax checks”. It does not prove you own the GTIN or that a partner will accept the label.
  • Check one: decode a GS1 DataMatrix from a photo or your camera. The reader names each field and shows the separators. Nothing is uploaded.
  • Many at once: the bulk generator takes a spreadsheet of values, one code per row.

Frequently asked questions

What is the difference between a GS1 Data Matrix barcode and a Data Matrix barcode?
They are the same symbol (Data Matrix ECC 200, ISO/IEC 16022). A GS1 DataMatrix adds two rules: it starts with the special FNC1 character, and its content is a chain of GS1 Application Identifier fields, such as (01) for the GTIN and (17) for the expiry date. A plain Data Matrix holds any text, and only the system that reads it knows what the text means. A scanner tells them apart by the symbology identifier it sends first: ]d2 for GS1, ]d1 for plain.
What is FNC1 in a GS1 DataMatrix?
FNC1 (Function 1) is a special Data Matrix character, codeword 232, that is not a letter or digit. In first position it marks the code as GS1. Later in the code it ends a variable-length field, such as a batch or serial number, when another field follows. Scanners never output FNC1 itself: the first one becomes the ]d2 prefix and the others become the group separator (ASCII 29).
Why do I see <GS> or strange characters when I scan?
That is the group separator, ASCII character 29, which ends variable-length fields. It has no printable form, so apps show it as <GS>, ^], a box, a space or nothing. A USB scanner typing into a text field may drop it or turn it into another key. Set the scanner to send it (many have a "GS1" or "FNC1 to GS" setting) and check the result in our reader, which shows it as a GS chip and splits the fields for you.
Is GS1 DataMatrix replacing UPC barcodes?
Not replacing, adding. GS1 US runs an industry goal called Sunrise 2027: retail checkout scanners should be able to read 2D codes (GS1 DataMatrix, and QR codes carrying a GS1 Digital Link) by the end of 2027. UPC barcodes stay valid, and GS1 asks brands that add a 2D code to keep the UPC as well during the move. There is no date after which UPCs stop working.
Do I need GS1 membership to make a GS1 DataMatrix?
You can make the symbol with any generator, including ours. The GTIN inside it is what needs a GS1 license: GTINs come from your GS1 member organization, and a made-up GTIN may collide with someone else’s product. Internal-only codes (for example AIs 91 to 99) do not need a GTIN.
How do I read a GS1 DataMatrix?
Scan it with a 2D scanner or app that supports Data Matrix, then split the output into fields: read the 2 to 4 digit AI; if the AI is on GS1’s predefined-length list, take that many characters, otherwise read up to the next group separator (or the end), even if the field’s length never varies; then repeat. Our Data Matrix reader does this in your browser and shows each field by name, for example (17) as a date. The scanning guide covers phones and USB scanners.