^GB Graphic Box

Graphic shapes ZPL caret command

Draws a box, or a line, with chosen width, height, border thickness, color and corner rounding.

Format ^GBw,h,t,c,r

^GB parameters

Parameters of ^GB
ParameterMeaningAccepted valuesDefault
wbox width (in dots)p. 210

The width of the box.

From the value of t up to 32000.

The value used for the thickness t, or 1.

hbox height (in dots)p. 210

The height of the box.

From the value of t up to 32000.

The value used for the thickness t, or 1.

tborder thickness (in dots)p. 210

The thickness of the border.

1 to 32000 dots

1
cline colorp. 210

The color of the border.

  • Bblack
  • Wwhite
B
rdegree of corner-roundingp. 210

How much the corners are rounded.

0 to 8

0 is no rounding and 8 is the heaviest rounding.

0

^GB notes and gotchas

  • Interaction

    The box is placed with ^FO like any other field, and its dimensions follow the unit chosen with ^MU: the guide's ^MU example writes the ^GB width, height and thickness in millimeters and in inches.

    pp. 210, 312
  • Note

    The same command draws boxes and lines. The guide gives the uses as highlighting information, dividing a label into areas and improving appearance.

    p. 210
  • Note

    If width and height are not given, the result is a solid box whose width and height equal the thickness t.

    p. 210
  • Note

    To get w and h in dots, work out the size in millimeters and multiply by the printhead's dots per millimeter, which the guide lists as 6, 8, 12 or 24.

    p. 210
  • Note

    Rounding radius = (rounding index / 8) x (shorter side / 2), where the shorter side is the smaller of width and height after the minimum and default values have been applied.

    p. 210
Where the guide contradicts itself (3)
  • Guide issue

    The guide's examples on pages 210 and 211 send a width of 0 (^GB0,203,20) and a height of 0 (^GB203,0,20) to draw a vertical and a horizontal line, although the stated range for w and h starts at the value of t. The rounding text mentions adjusting for minimum values, but the guide does not state the adjustment rule.

    pp. 210, 211
  • Guide issue

    The caption of the horizontal-line example on page 211 says thickness 30, while the code printed next to it uses thickness 20. The guide does not say which is intended.

    p. 211
  • Guide issue

    Density wording differs between pages: page 210 gives 153, 203, 300 and 600 dots per inch for 6, 8, 12 and 24 dots/mm, page 294 gives 152.4, 203.2, 304.8 and 609.6, and page 49 says 8/mm is 200 dpi. The guide's own box examples on page 210 use 300 by 200 dots for 1.5 by 1 inch, but 203 dots for 1 inch on page 211. Use dots per millimeter.

    pp. 49, 210, 211, 294

^GB example

example.zplZPL
^XA
^FO40,40^GB400,200,6,B,3^FS
^FO40,280^GB400,4,4^FS
^XZ

The first field is a box 400 dots wide and 200 high with a 6-dot black border and rounding index 3. The second is a field 400 dots wide and 4 high with thickness 4; the guide uses the same command for lines.

Guides that use ^GB

BarcoderX is a .NET SDK for thermal labels and barcodes. See how it prints and exports labels.

Source Zebra, ZPL II, ZBI 2, Set-Get-Do, Mirror, WML Programming Guide, P1134473-11EN Rev A, 2026/07/05, pages 49, 201, 204, 210 to 214, 294, 312.

Written by BarcoderX in its own words. Checked against the guide on 2026-11-14.

ZPL and ZPL II are trademarks of Zebra Technologies Corporation. This reference is written by BarcoderX in its own words from Zebra's published programming guide. BarcoderX is an independent product and is not affiliated with, endorsed by or sponsored by Zebra Technologies.