GS1 DATA TOOL
GS1 Digital Link URI builder
Generate the data URI that can be encoded in a QR Code or Data Matrix by a suitable barcode renderer.
Inputs
Results
Run the sample to see decoded fields and checks.
ON THIS DEVICE
Recent history
RULES USED
Method and formulas
The primary key AI 01 and supported key qualifiers are placed in the URI path; other attributes are added as percent-encoded query parameters.
Use a domain and resolver you control or are authorized to use. A syntactically valid URI does not create resolver content automatically.
GUIDE
What this tool does and when to use it
The GS1 Digital Link URI builder constructs a standards-compliant identifier that encodes a GTIN along with optional qualifiers such as batch or lot number, serial number, and expiration date. It follows the GS1 Digital Link specification by placing the primary identification key AI 01 and key qualifiers in the URI path while moving secondary attributes into percent-encoded query parameters. This approach produces a single web-resolvable string that supply-chain systems, mobile scanners, and resolver services can interpret without custom parsing logic. Manufacturers, contract packers, and brand owners use the tool when they need to publish product-level data on the web while preserving the original GS1 element strings for traceability and regulatory compliance.
Typical deployment scenarios include generating links for product registration portals, digital product passports, and recall management systems. The resulting URI can be printed on labels or embedded in electronic documents so that downstream partners obtain consistent identification regardless of the scanning device or software platform. Because the builder operates entirely in the browser, no data leaves the user session and no external API calls are required during URI construction. The tool also supports future extension to additional AIs such as country of origin or net weight when those values are supplied as query parameters, ensuring forward compatibility with evolving GS1 profiles.
Worked example with realistic numbers
Consider a pharmaceutical package carrying GTIN-14 09506000134352, batch LOT-2048, serial SN00042, and an expiration date of 31 December 2027. The builder receives the domain https://example.com together with these four data elements. It assembles the path component /01/09506000134352/10/LOT-2048/21/SN00042 and appends the query parameter ?17=271231. The complete URI therefore reads https://example.com/01/09506000134352/10/LOT-2048/21/SN00042?17=271231. This string satisfies both GS1 syntax rules and standard URI percent-encoding requirements for any future special characters.
| Element | Value | Placement |
|---|---|---|
| Domain | https://example.com | Base |
| GTIN (AI 01) | 09506000134352 | Path segment 1 |
| Lot (AI 10) | LOT-2048 | Path segment 2 |
| Serial (AI 21) | SN00042 | Path segment 3 |
| Expiry (AI 17) | 271231 | Query parameter |
Second worked example
A second scenario involves a consumer electronics accessory identified by GTIN-14 05012345678901 together with lot number BATCH-99 and a best-before date of 15 June 2026. The builder produces the URI https://id.example.org/01/05012345678901/10/BATCH-99?15=260615. Here the best-before AI 15 appears in the query string because it is an attribute rather than a key qualifier. The resulting link can be scanned by a mobile application that resolves the domain to retrieve safety data sheets or warranty registration forms while the embedded GS1 data remains machine-readable for inventory systems.
Formula and method table
| Input Field | AI | Units / Format | Output Component | Validation Rule |
|---|---|---|---|---|
| domain | n/a | HTTPS URL | URI scheme and authority | Must begin with https:// |
| gtin | 01 | 14-digit numeric string | First path segment after /01/ | Length exactly 14, valid check digit |
| lot | 10 | Alphanumeric, max 20 chars | Path segment after /10/ | Percent-encoded if required |
| serial | 21 | Alphanumeric, max 20 chars | Path segment after /21/ | Percent-encoded if required |
| expiry | 17 | YYMMDD numeric | Query key 17 | Six digits, valid calendar date |
| best before | 15 | YYMMDD numeric | Query key 15 | Six digits, valid calendar date |
| net weight kg | 310n | Decimal with implied point | Query key 310n | Up to six digits after implied decimal |
Units and conversions notes
GTIN-14 values must always contain fourteen digits; shorter GTINs are padded on the left with zeros before entry. Expiration dates follow the GS1 YYMMDD convention where the two-digit year is interpreted relative to the current century and the day component must be valid for the given month. Lot and serial strings accept any printable ASCII characters except the reserved delimiters / ? # and space; these characters are automatically percent-encoded by the builder. No unit conversion occurs because all inputs are already expressed in the canonical GS1 formats required by the Digital Link specification. When net weight is supplied, the builder appends the appropriate AI 310n parameter using the number of decimal places indicated by the final digit of the AI; users must therefore verify that the supplied numeric value matches the chosen precision to avoid downstream rounding errors.
Limitations
The builder produces only a syntactically correct URI; it does not create or update resolver records on the chosen domain. Users must separately configure a GS1 Digital Link resolver and populate it with the target product data. The tool performs no cryptographic signing and therefore cannot guarantee that the URI has not been altered after generation. Domain ownership verification remains the responsibility of the operator; using an unauthorized domain will result in resolution failures even when the URI syntax is perfect. The builder also omits support for compressed GS1 identifiers and does not validate against the full set of GS1 Application Identifier rules beyond the fields shown in the input form. Finally, generated URIs are limited to a single primary GTIN key; composite keys or multi-product bundles require manual post-processing.
Common mistakes
- Omitting the leading zero padding on GTIN-14 values produces an invalid identifier that many resolvers reject.
- Placing the expiration date inside the path instead of the query string violates the key-qualifier hierarchy and breaks compatibility with existing GS1 parsers.
- Failing to percent-encode special characters in lot or serial fields can generate malformed URIs that browsers or HTTP clients misinterpret.
- Entering a two-digit year outside the expected range or an impossible day-of-month value passes through without error but produces an unusable date attribute at resolution time.
- Using an HTTP domain instead of HTTPS triggers browser security warnings and violates the GS1 recommendation for secure resolution.
- Supplying a lot or serial value longer than twenty characters exceeds the GS1 length limit and may be truncated by receiving systems.
- Confusing AI 15 (best before) with AI 17 (expiry) leads to incorrect semantic interpretation by regulatory or traceability applications.
COMMON QUESTIONS
Frequently asked questions
How many characters are permitted in the lot field before percent-encoding occurs?
The builder accepts up to twenty alphanumeric characters for AI 10. Any reserved URI characters within that length are automatically percent-encoded; longer strings are truncated to the first twenty characters to remain within GS1 length limits.
What happens if the supplied GTIN-14 fails the check-digit calculation?
The builder still emits the URI but flags the GTIN as invalid in the interface. Resolution will succeed syntactically; however, downstream GS1 validation services will reject the identifier during product registration or recall checks.
Can the expiration date be omitted while still including lot and serial?
Yes. When the expiry field is left blank the query parameter is simply omitted, leaving the path /01/{gtin}/10/{lot}/21/{serial} intact. This produces a valid minimal Digital Link URI for items that do not carry expiration data.
Is the domain required to support HTTPS or will HTTP work?
The builder enforces an https:// prefix because GS1 Digital Link resolvers are expected to operate under TLS. Supplying an http:// domain triggers a warning and the resulting URI will be rejected by most modern browsers and resolver policies.
How are non-ASCII characters in the serial number handled?
Non-ASCII characters are UTF-8 encoded then percent-encoded according to RFC 3986. The resulting URI remains fully compliant with both GS1 and web standards, although some legacy scanners may require additional configuration to decode them.
Does the tool validate that the chosen domain actually hosts a GS1 resolver?
No. The builder performs only local syntax checks. Domain ownership and resolver configuration must be verified separately through DNS records and test resolution requests before the URI is placed on production packaging.
What is the maximum total length of the generated URI?
The builder caps the complete URI at 2048 characters to stay within common browser and HTTP header limits. Exceeding this length usually indicates excessively long lot or serial values that should be shortened or moved to a secondary data carrier.
Can multiple instances of the same AI appear in one URI?
The builder prevents duplicate AIs. If a user attempts to supply two different lot numbers, only the first value is retained in the path and a warning is displayed. This rule mirrors the GS1 rule that each element string may appear only once per identifier.