Launch

30% off your first month of Pro30% off month one$9.90 → $6.93

See plans
ZPL em PDF

Command · ^GB

^GB: boxes, lines and rules

^GB (Graphic Box) is the most used drawing command on a shipping label. Every divider between sender and recipient, every frame around a block and every black banner carrying a carrier's name comes out of it — including the lines, which are just boxes with one side set to zero.

Checked on September 1, 2026

The parameters, and the line trick

The form is ^GBw,h,t,c,r: width, height, border thickness, colour and corner rounding. The ^FO before it decides where the top-left corner sits, as with any field.

A line is the same command with one side zeroed: ^GB420,0,3 draws a 420-dot horizontal rule 3 dots thick, and ^GB0,300,3 draws a vertical one. There is no separate line command — this is the idiomatic form.

  • w — width in dots.
  • h — height in dots. Zero on either one makes a line.
  • t — border thickness in dots. Defaults to 1.
  • c — colour: B for black or W for white.
  • r — corner rounding, 0 to 8.

Why the box came out solid black

When the border thickness reaches the size of the box, the rectangle fills. ^GB300,80,80 is a 300-by-80 box with an 80-dot border — which is to say, a solid banner. That is not a bug; it is how a filled block is made in ZPL.

If you wanted just the frame and got a solid block, the third parameter is too large. A thickness of 3 to 5 dots is normal for a visible frame on a label at 203 dpi.

The banner with white text

The pattern is always the same: draw the filled box with ^GB, then position the text over it and mark the field with ^FR. ^FR reverses that field alone, so the text prints white against the black already there.

If you reach for ^LR instead of ^FR, the reversal applies to every field after it rather than to one — which is the cause of a label that goes inverted from halfway down.

Change a ^GB thickness and watch the box fill

Drag the file in, paste the code, or pick it from your device

.txt · .zpl · .prn · .zip · .pdf · .png · .jpg — 30 labels a day

The conversion happens in your browser: your file never leaves your device.How that works
Free, no signupNo uploadNo watermarkBatches of many filesPDF · PNG · ZIP

Questions

Frequently asked questions

What does ^GB mean in ZPL?

^GB stands for Graphic Box and draws a rectangle at the position set by the preceding ^FO. With the width or the height at zero, the same command draws a line.

How do I draw a line in ZPL?

With ^GB itself, zeroing one side: ^GB420,0,3 is a 420-dot horizontal rule 3 dots thick, and ^GB0,300,3 is a vertical one. There is no separate line command.

Why did my box come out filled with black?

The border thickness reached the size of the box. In ^GB300,80,80 the border is 80 dots on a box 80 dots tall, which fills it completely. For a frame, use a thickness of 3 to 5 dots.

How do I make white text on a black background?

Draw the filled box with ^GB, position the text over it with ^FO, and mark the field with ^FR before the font. ^FR reverses that field only; ^LR would reverse every field after it.

Other guides