Introduction
The barcode turned 50 years old not long ago. JAN/EAN-13 has served as infrastructure for identifying products, and in doing so helped grow not just retail but a whole range of industries, logistics included.
Over the next 50 years, we add product information (expiry dates, lot numbers) on top of that, building a new infrastructure shared over the internet. That's GS1 Sunrise 2027.
GS1 Sunrise 2027 is an industry target for retail POS systems to be able to scan 2D barcodes (GS1 QR Code / GS1 DataMatrix) by the end of 2027. During the transition, 2D barcodes are expected to be dual-marked alongside 1D barcodes such as EAN-13 / JAN.
In the end, this leads to one thing: food safety and trust. If expiry dates and lot numbers can be carried in the barcode itself, recalls and expiry checks get a lot more precise.
But from a practical standpoint, this is a real headache. Meeting the GS1 size requirements often means the 1D/2D pair no longer fits on the label. This is especially true on 203 dpi thermal printers, which are common in Japan and offer only a limited set of print sizes.
I measured exactly how bad this gets, and built a core library, BarBridge, plus a browser tool, tools.barbridge.org, to let anyone simulate it themselves. Here's how it went.
1. What exactly doesn't fit
GS1 specifies a minimum X-dimension (module width) for barcodes:
- 1D barcodes: 0.264mm–0.660mm
- 2D barcodes: 0.396mm–0.990mm
A 203 dpi thermal printer has a dot size of about 0.125mm, so in dots:
| Dots | Physical size (203dpi) | Meets the 2D minimum (0.396mm)? |
|---|---|---|
| 3 dots | 0.375mm | ❌ Just short |
| 4 dots | 0.50mm | ✅ Effective minimum |
So on a 203dpi printer, 4 dots (0.50mm) is the effective minimum for a 2D symbol.
Meanwhile, JAN (EAN-13) is commonly fixed at 3 dots, which comes out to 42.4mm wide including quiet zones. Put a 2D symbol next to that, side by side, and it no longer fits on a 50mm-wide label.
On top of that, GS1 has a practical "50mm rule" requiring a minimum gap between symbols when the target object is 50mm or smaller — so you can't just squeeze them together either.
The realistic solution that came out of this:
- Stack them vertically instead of side by side
- Use GS1 DataMatrix for the 2D symbol (more space-efficient than QR)
This combination satisfies both the 50mm rule and a 50mm-wide label at the same time.
The full technical note is available here.
2. Making sense of GS1 Application Identifiers (AIs)
The two 2D symbols involved in Sunrise 2027 actually encode different kinds of data:
- GS1 QR Code: a GS1 Digital Link URI (data shaped like a URL, usable both on the web and at POS)
- GS1 DataMatrix: a raw GS1 element string (FNC1/GS-separated, not a URL, typically used upstream of the register — receiving, picking, expiry checks, recalls)
Both encode GTIN, lot numbers, expiry dates, etc., using Application Identifiers (AIs). Here are the common ones:
| AI | Meaning | Length / format |
|---|---|---|
| 01 | GTIN | Fixed 14 digits (with check digit) |
| 17 | Use-by / expiry date | Fixed 6 digits (YYMMDD) |
| 15 | Best-before date | Fixed 6 digits (YYMMDD) |
| 11 | Production date | Fixed 6 digits (YYMMDD) |
| 13 | Packaging date | Fixed 6 digits (YYMMDD) |
| 10 | Batch / lot number | Variable, up to 20 alphanumeric |
| 21 | Serial number | Variable, up to 20 alphanumeric |
| 310n | Net weight (kg) | Variable measure, 31nn–36nn family |
| 392n | Amount | Variable, 390n/392n family |
| 22 | Consumer product variant | Variable |
| 422 | Country of origin | Fixed 3 digits (ISO 3166-1 numeric) |
For example, a logistics-oriented GS1 element string looks like this:
(01)04901234567894(10)LOT42(17)271231
GTIN + lot number + expiry date — and this can be encoded directly into a GS1 DataMatrix.
3. Building a tool to simulate this in real dimensions
Doing this math by hand every time is painful, so I built a browser tool that shows physical size, dot count, and 50mm-rule pass/fail just from form input.
What it does:
- Individual input fields for each AI (01/17/15/11/13/10/21/3102/3922/22/422), each validated for length/format
- From a GTIN (01), generates both a Digital Link URI (for GS1 QR Code) and an element string (for GS1 DataMatrix)
- Converts to dot counts at 203/300/600 dpi and checks the 50mm rule pass/fail
- Outputs three separate formats:
- PNG (1bpp): pure black-and-white, no anti-aliasing — meant to be sent straight to a printer
- PDF: vector, with the MediaBox set to the label's actual physical size — for checking real-world dimensions
- SVG: for on-screen display and editing
A GTIN (01) is required to generate anything — there's no placeholder fallback, by design, so you're always working with real data.
4. Implementation: bringing a Rust core into the browser via WASM
This tool runs with no server at all — just static HTML/JS/WASM.
Why WASM
I initially considered a native app, but went with WASM because:
- Anyone on-site can check it right there in a browser
- No installation, OS-independent
- The core logic (GS1 AI parsing/validation, layout calculation, rendering) stays shared with bindings for other languages (Python, C/C++, C#, VB.NET, Java, PHP, Node.js)
So the Rust core is brought into the browser directly via wasm-bindgen:
barbridge-core (Rust: GS1 AI parsing/validation/layout/rendering)
└─ barbridge-wasm (wasm-bindgen bindings)
└─ static HTML + JS (no server — just FTP upload)
A gotcha: WASM doesn't load over file://
Double-clicking index.html and opening it over file:// gets WASM's fetch blocked by CORS, leaving a blank canvas. This is an easy trap to fall into — testing locally requires a local HTTP server (e.g. python -m http.server), not a direct file open.
Why PNG (1bpp) and PDF are separate
I initially thought SVG alone would be enough, but real-world usage turned out to need two distinct things:
- Sending directly to a thermal printer needs a non-anti-aliased 1bpp bitmap
- Checking physical dimensions / print preview needs a vector PDF whose page size is the actual physical size
So render_png_1bpp() and render_pdf() are implemented as separate functions. PDF generation uses the pdf-writer crate, with no embedded fonts, to keep it lightweight.
Conclusion
GS1 Sunrise 2027 is a big target — "2D support by the end of 2027" — but at the ground level there are a lot of small, concrete problems, like "does this actually fit on a 203dpi label."
The tool and core library, BarBridge, were built to support this transition. The library itself is currently in preview, with sample code published on GitHub.
If you want to try simulating your own real-world label sizes, give tools.barbridge.org a try.
GS1 is a registered trademark of GS1 AISBL. This article and BarBridge are not affiliated with GS1 or GS1 Japan. Figures in this article are estimates and do not represent the official position of GS1 or GS1 Japan.
Top comments (0)