ZPL GS1-128 example, annotated line by line
A complete ZPL label with a GS1-128 SSCC barcode that you can copy, followed by an explanation of every line. The code on this page is generated by the same library as the label generator, so it cannot drift from what the tool produces.
The complete example (203 dpi)
A 4 x 6 inch GS1 logistic label for SSCC 006141410000000012. The addresses are invented.
^XA
^CI28
^PW812
^LL1218
^LH0,0
^FO30,24^A0N,25,20^FDFROM^FS
^FO152,24^A0N,25,20^FDNorthwind Supply Co^FS
^FO152,55^A0N,25,20^FD1200 Industrial Pkwy^FS
^FO152,85^A0N,25,20^FDReno, NV 89502^FS
^FO30,154^GB751,3,3^FS
^FO30,175^A0N,25,20^FDTO^FS
^FO152,175^A0N,39,22^FDContoso Retail DC 14^FS
^FO152,221^A0N,39,22^FD8800 Distribution Way^FS
^FO152,268^A0N,39,22^FDDenver, CO 80202^FS
^FO30,365^GB751,3,3^FS
^FO30,382^A0N,25,20^FDCARRIER^FS
^FO30,416^A0N,37,23^FDExample Freight^FS
^FO558,382^A0N,25,20^FDCARTON^FS
^FO558,416^A0N,37,17^FD1 OF 12^FS
^FO30,479^A0N,25,20^FDPO NUMBER^FS
^FO30,514^A0N,37,26^FDPO-4471902^FS
^FO30,577^GB751,3,3^FS
^FO30,589^A0N,25,20^FDSSCC^FS
^FO30,625^A0N,61,41^FD006141410000000012^FS
^FO30,698^GB751,3,3^FS
^FO94,735^BY4^BCN,305,N,N,N,N^FD>;>800006141410000000012^FS
^FO95,1056^A0N,32,28^FD(00) 006141410000000012^FS
^XZThe barcode line, piece by piece
Everything specific to GS1-128 is in one line. The pieces, as documented in Zebra's ZPL II guide for ^BC:
^BY4sets the module width, the width of the narrowest bar, to 4 dots.^BCN,h,N,N,N,Ndraws Code 128: normal orientation,hdots tall, no interpretation line from the printer, no UCC check digit added by the printer, and modeN, meaning no automatic mode. With modeNthe printer encodes exactly what the field data says.>;at the start of the field data selects subset C, where each pair of digits becomes one barcode character.>8is FNC1. Directly after the start code it is what makes this a GS1-128 barcode rather than plain Code 128.00is the application identifier for an SSCC, and the 18 digits after it are the SSCC including its check digit. No parentheses: those are for people.
The parentheses appear in the next line instead, a plain text field reading (00) 006141410000000012. Zebra's guide describes this approach: turn the interpretation line off and write a separate text field so the text can show parentheses. The check digit in that text has to be correct, because the printer is not calculating it. The generator calculates it, and you can confirm any number with the check digit calculator.
Invocation codes used in GS1-128 field data
Inside ^BC field data, a > followed by one character is a control code, not data. These are the ones a GS1-128 barcode needs, from the invocation table in Zebra's guide:
| Code | Meaning |
|---|---|
| >; | Start in subset C (pairs of digits) |
| >: | Start in subset B (letters, digits, punctuation) |
| >8 | FNC1. Right after the start it makes the symbol GS1-128. Later on it is the separator. |
| >6 | Switch from subset C to subset B |
| >5 | Switch from subset B to subset C |
| >0 | A literal > character in subset B |
One trap is worth knowing. Zebra's guide says that in subset C an extra unpaired digit just before a code shift is ignored. So an odd number of digits cannot simply be left in subset C: the last digit has to be moved into subset B with >6 first. The encoder on this site always does that.
More field data examples
The same encoder, given other element strings:
| Printed text | ^FD field data | What to notice |
|---|---|---|
| (10)2503X | >;>8102503>6X | Digits in subset C, then a switch to B for the letter. |
| (37)24(400)PO-7781 | >;>83724>840>60PO->57781 | A separator after the count, because (37) has no predefined length. |
| (01)09521234500001(10)ABC123 | >;>8010952123450000110>6ABC123 | No separator after the GTIN. Its length is predefined. |
Which element strings need the >8 separator is covered in the application identifier table.
Every line explained
| ZPL | What it does |
|---|---|
| ^XA | Start of the label format. |
| ^CI28 | Text is UTF-8. |
| ^PW812 | Print width: 4 inches at 203 dpi. |
| ^LL1218 | Label length: 6 inches at 203 dpi. |
| ^LH0,0 | Label home at the top left corner. |
| ^FO30,24^A0N,25,20^FDFROM^FS | Data title "FROM". |
| ^FO152,24^A0N,25,20^FDNorthwind Supply Co^FS | Address line. |
| ^FO152,55^A0N,25,20^FD1200 Industrial Pkwy^FS | Address line. |
| ^FO152,85^A0N,25,20^FDReno, NV 89502^FS | Address line. |
| ^FO30,154^GB751,3,3^FS | Rule between label zones, drawn as a filled box. |
| ^FO30,175^A0N,25,20^FDTO^FS | Data title "TO". |
| ^FO152,175^A0N,39,22^FDContoso Retail DC 14^FS | Address line. |
| ^FO152,221^A0N,39,22^FD8800 Distribution Way^FS | Address line. |
| ^FO152,268^A0N,39,22^FDDenver, CO 80202^FS | Address line. |
| ^FO30,365^GB751,3,3^FS | Rule between label zones, drawn as a filled box. |
| ^FO30,382^A0N,25,20^FDCARRIER^FS | Data title "CARRIER". |
| ^FO30,416^A0N,37,23^FDExample Freight^FS | Field value. |
| ^FO558,382^A0N,25,20^FDCARTON^FS | Data title "CARTON". |
| ^FO558,416^A0N,37,17^FD1 OF 12^FS | Field value. |
| ^FO30,479^A0N,25,20^FDPO NUMBER^FS | Data title "PO NUMBER". |
| ^FO30,514^A0N,37,26^FDPO-4471902^FS | Field value. |
| ^FO30,577^GB751,3,3^FS | Rule between label zones, drawn as a filled box. |
| ^FO30,589^A0N,25,20^FDSSCC^FS | Data title "SSCC". |
| ^FO30,625^A0N,61,41^FD006141410000000012^FS | The SSCC as large text, for people reading the label. |
| ^FO30,698^GB751,3,3^FS | Rule between label zones, drawn as a filled box. |
| ^FO94,735^BY4^BCN,305,N,N,N,N^FD>;>800006141410000000012^FS | GS1-128 barcode. ^BY4 sets the module width to 4 dots. ^BCN draws Code 128 305 dots tall with the printer's own interpretation line off and no automatic mode. In the data, >; starts subset C, >8 is FNC1 (which makes it GS1-128), then the AI and its digits. |
| ^FO95,1056^A0N,32,28^FD(00) 006141410000000012^FS | Human readable interpretation of the barcode, with the AI in parentheses. Printed as its own text field because the printer's interpretation line omits the parentheses. |
| ^XZ | End of the label format. The printer prints it. |
What changes at 300 dpi
ZPL positions are in printer dots, so the same label on a 300 dpi printer needs different numbers throughout: ^PW and ^LL become 1200 and 1800, and every ^FO coordinate and font size is larger. The barcode is not scaled by multiplying. A module must be a whole number of dots, so it goes from 4 dots to 6, which keeps it inside the 0.495 to 0.940 mm range the GS1 General Specifications set for logistic units (table 5-51). The barcode line at 300 dpi:
^FO132,1086^BY6^BCN,450,N,N,N,N^FD>;>800006141410000000012^FSThe field data is identical. Only the position, module width and height change. The size rules are explained on the GS1-128 label page.
Text safety
^ and ~ start commands in ZPL, so an address containing either would break the label. When a text field contains one, the generator writes the field with ^FH_ and replaces the character with a hex escape, _5E or _7E. Text without those characters is written as it is.
This example is for reading and adapting. To get the same label with your own shipment data, use the generator. For the label's layout rules see the pallet label template and the SSCC label guide.
Make this label now: fill in the shipment, preview it, and copy or download the ZPL.
Open the label generatorSources
- ZPL II Programming Guide: ^BC, Code 128 Barcode (Subsets A, B, and C). Zebra Technologies. Online guide. Read 9 October 2026.
- GS1 General Specifications Standard. GS1. Release 26.0, ratified January 2026. Read 9 October 2026.