How to Wrap Text in ZPL with the ^FB Field Block Command

October 1, 2026 · 3 min read · By ZPLFONTS.com

zpllayouthow-to

ZPL doesn’t wrap text on its own. If you print a long product name at ^FO40,40, it runs in a straight line off the right edge of the label and gets cut. Anyone who prints variable text, such as addresses, descriptions or notes, needs a way to wrap it. That’s what the field block command, ^FB, is for.

The syntax in one breath

^FBwidth,max-lines,line-spacing,justification,hanging-indent

You put it after the ^FO and font command and before the ^FD. A typical use looks like this:

^XA
^FO40,40^A0N,32,32^FB700,4,6,L,0^FDThis longer description will wrap inside a box seven hundred dots wide and no more than four lines tall.^FS
^XZ

Let’s go through the parts.

Width is the width of the text box in dots. The printer wraps lines so none is wider than this. Choose it so the box plus its left offset fits within the print width, or you’ll be back to clipped text.

Max lines is the largest number of lines the block may hold. This one catches people. If your text needs six lines and you say four, the last two are silently dropped. Always allow more lines than you think you’ll need, and check long examples.

Line spacing is an extra gap added between lines, in dots, and can be negative to tighten things. Zero gives the font’s natural spacing.

Justification is L for left, C for centre, R for right and J for justified. Centring text in a box is the easiest way to centre it on a label, since otherwise you’d have to calculate each string’s width.

Hanging indent indents every line after the first by this many dots, handy for lists or labels with a leading caption.

Forcing a line break

Inside a field block you can start a new line with the two characters \&. That lets you put structure in the data, such as a name on one line and an address on the next, while still letting long lines wrap.

^FB600,5,0,L,0^FDACME Supplies\&12 High Street\&Springfield^FS

The live preview has a wrapped text sample that includes this, so you can see how it behaves.

Centring a single line

Because ^FB has justification, it’s the easiest way to centre text. Make the block as wide as the area you want to centre within, set one line, and choose C:

^FO0,60^A0N,48,48^FB812,1,0,C,0^FDCentred title^FS

On a 203 DPI four-inch label, 812 is the full width, so the title centres across the whole label. This is much sturdier than guessing an x position, because it works for any text length.

The ways text goes missing

Too few lines is the first, as noted. A box wider than the printable area is the second: text may print fine in the preview and be clipped on paper. Both are covered in text cut off or wrong size.

Another is a single word wider than the box. The printer can’t hyphenate, so very long words or codes may overflow or be broken awkwardly. If your data can contain long unbroken strings, like URLs or serial numbers, plan for them with a smaller font or a wider box.

There’s also a gotcha with rotated text. Field blocks follow the field’s orientation, so a rotated block wraps along a vertical axis. Check the width against the label length in that case.

Fitting variable text sensibly

A field block gives you wrapping, but it doesn’t shrink text. If a long value wraps to eight lines and you only have room for three, the label is wrong however neatly it wraps. Decide in your software what to do about overlong values: use a smaller font for long strings, shorten them, or flag them. One common pattern is to choose between two or three font sizes depending on string length, and test with the longest real value you’ve got.

If you want to experiment, the label generator can output a block with the alignment of your choice.

Fonts and wrapping

The block measures text with the font you’ve chosen, so a different font wraps differently. A condensed width fits more per line. Changing font, size or character set means re-checking your wrapping. See the ^A command guide for how height and width interact, and ^CF, ^FD and ^FO basics for placement.

Checklist

Give the block a width that fits the label. Allow plenty of lines. Test the longest value. Don’t assume a preview is exact. And when your text includes special characters, mind your character set, as in the UTF-8 checklist.

All articles