Disclosure. Closient counts serial and lot records in its plans, so a recommendation that leads towards serials is one we benefit from. That is why the version arithmetic below is shown first and the table is reproducible with any QR encoder. Check the numbers, then decide.
The short answer
- Perishables: encode a best before date (AI
15). Use AI17instead when the date is a safety or regulatory limit. - Everything else: encode a serial number (AI
21). The serial is a pointer, not a payload. - Do not encode the lot (AI
10) if you can serialize. The serial implies the lot, and the resolver knows which lot each serial belongs to. - Do not encode anything that can change after printing. Put it in the resolver.
- One QR code. If the data does not fit the sizing envelope, remove data rather than adding a second symbol.
The test
Ask one question of every Application Identifier:Must a machine act on this at the moment of scan, before any network call can complete?A date passes. When a cashier scans a carton of yogurt, the register decides sell, mark down or block in the same instant it rings up the price. That decision cannot wait on a web request, and it has to keep working when the store’s network does not. A lot fails. Whether a lot is under recall is a question for the resolver, answered on the timescale of a person looking at a phone. Almost every other AI fails too.
What an Application Identifier is
An Application Identifier (AI) is a numeric prefix that tells a scanner what the data after it means. AI01 is a GTIN, AI 21 a serial number, AI 15 a best before date.
In a GS1 Digital Link, the AIs become parts of a web address:
- The GTIN (
01) and its key qualifiers are path segments, in a fixed order: consumer product variant (22), then lot (10), then serial (21). The standard requires that sequence to be preserved (URI Syntax 1.7.0, section 4.9). - Data attributes, which include dates, count and weight, go in the query string as
key=valuepairs. That is a requirement of the standard, not a convention (URI Syntax 1.7.0, section 4.10).
YYMMDD. A day of 00 means the last day of that month (GS1 General Specifications, Release 26.0, section 3.4.5).
Build the URI with the Closient Digital Link builder rather than by hand.
The catalog
GS1 defines hundreds of Application Identifiers. If one you want is not listed, the answer is almost always: put it in the resolver, not the URI.
AI 21: the serial is a pointer
A serial is assigned to an item for its lifetime and, combined with a GTIN, identifies one individual unit (General Specifications, section 3.5.2). The field is alphanumeric and up to 20 characters. Treat it as a key, not a container. When a scanner resolves a serialized Digital Link, the resolver already knows which lot that unit came from and the dates recorded against it. In Closient, each serial links to its lot, so a recall scoped to a lot automatically covers the serials in it, and rules and destinations can be scoped to an exact serial, a lot or a group. You get lot-level precision with roughly ten characters on the pack. Keep serials short, uppercase alphanumeric, and meaningless. AI21 allows 20 characters; use 8 to 10. Every character past what uniqueness needs is wasted modules. Serial values are case-sensitive GS1 data, so mint them uppercase rather than folding case afterwards.
AI 15 and AI 17: the date split
GS1 draws the line itself.- AI
15, best before date, “signifies the end of the period under which the product will retain specific quality attributes or claims even though the product may continue to retain positive quality attributes after this date” (section 3.4.5). - AI
17, expiration date, is “the date that determines the limit of consumption or use of a product.” For food, “the date will indicate the possibility of a direct health risk resulting from use of the product after the date” (section 3.4.7).
15 means mark it down. 17 means pull it.
On the law, keep to the general picture and check your own products and markets. In the United States, USDA FSIS notes that product dating is not required by federal regulation except for infant formula, and some states regulate particular products. In Canada, CFIA states that it is not illegal to sell food past its best before date, while food past its expiration date should not be bought, sold or eaten, and expiration dates are required only on certain foods such as infant formula. This is not legal advice.
The date has to be in the code itself, not behind the resolver. GS1’s 2D barcodes at retail point-of-sale guideline lists preventing the sale of out-of-date product and date-based markdowns among the benefits of encoding data beyond the GTIN (section 4.4.1), and notes that point-of-sale systems may need upgrading to use it (section 4.4). Check that your retail partners’ systems read the AIs you encode.
Dates also pass the “will it change” test. A date is fixed at fill time and printed per run, which is the cadence the packaging line already works at.
For infant formula, which carries a mandatory date, see Infant formula expiration dates. For AB 660 label wording driven by these same AIs, see AB 660 date labels.
The cost of every AI
Each AI adds characters, and characters set the symbol version. The table below encodes a GTIN with each combination, uppercase, at error correction level M, using Zint 2.15.0. Sizes are the symbol only at the 0.495 mm target X-dimension, before the quiet zone.
Test values: GTIN
09506000134352, lot LOT4711, serial ABC12345, date 271031.
The last row is the anti-pattern. Everything it puts on the pack in lot form, the serial row already delivers through the resolver, at a full version smaller on a short host.
Two things the table shows that character counts alone hide:
- A date costs more than its characters. The
?and=that start a query string are outside the QR alphanumeric character set, so a single data attribute forces part of the symbol into a less dense mode. On the short host, GTIN plus a 13-character serial plus a best before date is 61 characters and encodes at version 4, while GTIN plus lot plus the same serial is 62 characters and encodes at version 3. A shorter string, a bigger symbol. - The serial buys the version back. The date is the exception that earns its cost. Choosing a serial over a lot, and keeping it short, is how you pay for it.
Opinions, stated plainly
- A lot on the URI is usually a smell. If you can serialize, the serial implies the lot. The legitimate case for AI
10is product you cannot serialize, such as fresh-cut produce, or a scan by trading partners with no signal. See Lot-scoped recalls and the 2026 lettuce recall. - A date on the URI is not a smell. It is the textbook case for on-pack data.
- Do not encode data that can change. The code is printed and immutable. Anything that might be corrected later belongs in the resolver.
- One QR code. Do not print a second symbol to carry extra AIs.
Where Closient fits
The Digital Link builder composes the URI for you, adding the lot, serial and date AIs you choose in the order the standard requires, and hands off to the print size tool so you can see what the combination does to the printed size before you commit artwork.QR code sizing
Why data length sets the symbol size, with size tables in millimetres and inches.
Infant formula expiration dates
The one food with a mandatory date, and why it belongs in AI 17.
Lot-scoped recalls
How recall status resolves per lot.
Printing QR labels
See the exact Digital Link that will be encoded before it goes to plate.