GS1-128 Parser

Paste the string under a logistics barcode — with brackets or straight off the scanner — and see every field it contains, what each one means, and whether it is well formed.

🔒 Your data never leaves your browser.

The rule that breaks most parsers

GS1 splits Application Identifiers into two kinds. Some have a predefined length — decided by the AI's first two digits, not by the AI itself — and are followed immediately by the next AI with no separator. Everything else is variable length and must be terminated by FNC1 (the GS character) unless it is the last element in the string.

Miss that, and a batch number quietly swallows the serial number that follows it. The string still "parses"; it just produces the wrong data. This tool applies the real rule and tells you explicitly when a separator is missing rather than handing you a plausible-looking mistake.

Predefined-length AI prefixes

AI starts withTotal element length
118 characters (including the AI)
128 characters (including the AI)
138 characters (including the AI)
148 characters (including the AI)
158 characters (including the AI)
168 characters (including the AI)
178 characters (including the AI)
188 characters (including the AI)
198 characters (including the AI)
204 characters (including the AI)
3110 characters (including the AI)
3210 characters (including the AI)
3310 characters (including the AI)
3410 characters (including the AI)
3510 characters (including the AI)
3610 characters (including the AI)
4116 characters (including the AI)
0020 characters (including the AI)
0116 characters (including the AI)
0216 characters (including the AI)
0316 characters (including the AI)
0418 characters (including the AI)

Every other AI is variable-length and needs a separator.

Dates: two digits, sliding century, and day 00

GS1 dates are YYMMDD. The two-digit year resolves against a sliding window — 49 years back, 50 years forward from today — so the same digits mean a different century depending on when the label is read. And a day of 00 is not an error: it means the end of that month, which is how "best before end of March" gets encoded.

(15) best before is not (17) expiration

Best before is a quality date — the product is still safe afterwards. Expiration is a safety date. Swapping them is a compliance problem, not a formatting one, and the two AIs sit right next to each other on the keyboard.

Every check this tool runs (10 rules)

AI-S01Missing FNC1 separator after a variable-length field

A variable-length element must be terminated by FNC1 (encoded as the GS character) unless it is the last element in the string. Without it there is no way to tell where the data ends and the next AI begins — the scanner reads the following AI as part of your batch number.

Fix: Insert a group separator after the variable-length field. In the human-readable form this is implicit; in the encoded data it must be a real FNC1.

Source: GS1 General Specifications — Application Identifier definitions and the table of predefined-length AIs. Rules verified against real GS1-128 element strings in our regression tests.

AI-S02Unexpected separator after a predefined-length field

AIs whose length is predefined by their first two digits must NOT be followed by a separator. An extra FNC1 there is a common encoder bug and makes the string non-conformant.

Fix: Remove the separator after fixed-length elements such as (01), (17) and (00).

Source: GS1 General Specifications — Application Identifier definitions and the table of predefined-length AIs. Rules verified against real GS1-128 element strings in our regression tests.

AI-S03Truncated element

The string ends before this element has all the characters its AI requires.

Fix: Check that the barcode was scanned completely; a partial read usually means a damaged symbol.

Source: GS1 General Specifications — Application Identifier definitions and the table of predefined-length AIs. Rules verified against real GS1-128 element strings in our regression tests.

AI-F01Wrong data length

The data does not match the length its AI defines — fixed-length AIs need exactly that many characters, variable-length ones must not exceed their maximum.

Source: GS1 General Specifications — Application Identifier definitions and the table of predefined-length AIs. Rules verified against real GS1-128 element strings in our regression tests.

AI-F02Invalid characters for this AI

Numeric AIs accept digits only. Alphanumeric AIs use the GS1 AI character set — uppercase letters, digits and a limited set of symbols; lowercase letters are not permitted.

Source: GS1 General Specifications — Application Identifier definitions and the table of predefined-length AIs. Rules verified against real GS1-128 element strings in our regression tests.

AI-C01Check digit does not match

GTIN, SSCC, GLN and GSIN values carry a GS1 Mod-10 check digit. A mismatch means the number is wrong, not merely formatted oddly.

Source: GS1 General Specifications — Application Identifier definitions and the table of predefined-length AIs. Rules verified against real GS1-128 element strings in our regression tests.

AI-D01Invalid date

GS1 dates are YYMMDD. A day of 00 is legal and means "end of the month"; any other impossible date is an error.

Source: GS1 General Specifications — Application Identifier definitions and the table of predefined-length AIs. Rules verified against real GS1-128 element strings in our regression tests.

AI-D02Two-digit year is interpreted by a sliding window

GS1 resolves a two-digit year to the range from 49 years before to 50 years after the current year. The same digits therefore mean different centuries depending on when they are read.

Source: GS1 General Specifications — Application Identifier definitions and the table of predefined-length AIs. Rules verified against real GS1-128 element strings in our regression tests.

AI-U01Unknown Application Identifier

This AI is not in the tool's table. GS1 adds AIs over time, so an unknown code is not automatically invalid — but without a definition we cannot tell how long its data should be, so parsing stops here.

Source: GS1 General Specifications — Application Identifier definitions and the table of predefined-length AIs. Rules verified against real GS1-128 element strings in our regression tests.

AI-L01Element appears more than once

Most AIs may appear only once in an element string. A repeat usually means two barcodes were concatenated.

Source: GS1 General Specifications — Application Identifier definitions and the table of predefined-length AIs. Rules verified against real GS1-128 element strings in our regression tests.

Application Identifiers this tool knows (30)

Conservative coverage of the AIs seen on everyday trade and logistics labels. An AI outside this list stops the parse rather than being guessed at — without a definition there is no way to know how long its data is.

AIMeaningData
(00) SSCC 18 digits, fixed
(01) GTIN 14 digits, fixed
(02) GTIN of contained trade items 14 digits, fixed
(10) Batch or lot number up to 20 characters, variable
(11) Production date 6 digits, fixed
(12) Due date 6 digits, fixed
(13) Packaging date 6 digits, fixed
(15) Best before date 6 digits, fixed
(16) Sell by date 6 digits, fixed
(17) Expiration date 6 digits, fixed
(20) Variant number 2 digits, fixed
(21) Serial number up to 20 characters, variable
(22) Consumer product variant up to 20 characters, variable
(30) Variable count up to 8 digits, variable
(37) Count of trade items up to 8 digits, variable
(90) Mutually agreed information up to 30 characters, variable
(240) Additional product identification up to 30 characters, variable
(241) Customer part number up to 30 characters, variable
(400) Customer purchase order number up to 30 characters, variable
(401) Consignment number (GINC) up to 30 characters, variable
(402) Shipment number (GSIN) 17 digits, fixed
(410) Ship to / deliver to GLN 13 digits, fixed
(411) Bill to / invoice to GLN 13 digits, fixed
(412) Purchased from GLN 13 digits, fixed
(413) Ship for / deliver for GLN 13 digits, fixed
(414) Physical location GLN 13 digits, fixed
(3100) Net weight (kg) 6 digits, fixed
(3103) Net weight (kg, 3 decimals) 6 digits, fixed
(3200) Net weight (lb) 6 digits, fixed
(3202) Net weight (lb, 2 decimals) 6 digits, fixed