Food label template in ZPL
A food label in ZPL carries the product and net quantity, a lot number, a best-before or use-by date, an allergen line and an EAN-13 barcode. Copy the 4 × 2 in template below and change the fields.
Bijgewerkt 2026-11-01 · Renders made with the OpenZPL engine
Open in de viewerWhat goes on a food label
- Product and net quantity, and storage if it matters ("keep refrigerated").
- A lot or batch number and a best-before / use-by date, for traceability and recalls.
- An allergen line — on many labels the law requires allergens to stand out.
- An EAN-13 barcode (
^BE) for retail scanning.
4 × 2 in food template
Product, lot, best-before, an allergen line and an EAN-13 barcode, laid out for 812 × 406 dots:

^XA ^CI28 ^PW812 ^LL406 ^FO30,26^A0N,44,44^FDStrawberry Yogurt 500 g^FS ^FO30,78^A0N,26,26^FDOpenZPL Dairy - Keep refrigerated 2-6 C^FS ^FO30,118^GB752,2,2^FS ^FO30,140^A0N,26,26^FDLOT^FS ^FO110,136^A0N,34,34^FDL240926^FS ^FO30,186^A0N,26,26^FDBEST BEFORE^FS ^FO250,182^A0N,34,34^FD26/09/2027^FS ^FO30,232^A0N,24,24^FDContains: MILK. May contain NUTS.^FS ^BY2,2,90 ^FO520,120^BEN,90,Y,N^FD590123412345^FS ^XZ
Write the date in your country's format and keep the lot field short. The allergen line uses capitals for the allergen names, a common convention; follow your local rule.
Render it from your code
curl https://api.openzpl.com/v1/printers/8dpmm/labels/4x2/0/ \ --data-binary @label.zpl > label.png
Every template on this page renders through the same API. Send the ZPL as the request body and get a PNG or PDF back; see the API docs and ZPL to PDF.
Vragen
What should a food label barcode be?
EAN-13 (^BE) for retail food in most of the world, UPC-A (^BU) in North America. The lot number and date are usually plain text, not a barcode.
How do I add a use-by date instead of best-before?
Change the label text: ^FDUSE BY^FS and the date field. The date is plain text, so put it in whatever format your market expects (DD/MM/YYYY, MM/DD/YYYY).