Printing barcode and container labels from LASSO runs on ZPL (Zebra Programming Language), the simple, text-based language your Zebra printer reads to lay out everything on a label: text, barcodes, QR (Quick Response) codes, boxes, and logos.
With a handful of commands and a few tricks, you can design labels that print fast, scan reliably, and look sharp every time. This guide walks you through the essentials, from setting your print resolution to dialing in density and speed.
In This Guide
Start With the Right Resolution (DPI)
Size Your Label Correctly
Dial In Print Density (Darkness)
Set the Right Print Speed
Place & Center Your Content
Barcodes & QR Codes Done Right
Adding a Logo
Preview Before You Print
Common Pitfalls to Avoid
Quick Reference Cheat Sheet
Troubleshooting
Start With the Right Resolution (DPI)
Every Zebra printer prints at a fixed resolution, measured in dots per inch (DPI). This is the single most important number to get right, because every position and size in your ZPL is measured in dots, not inches.
The two most common desktop resolutions are:
203 DPI (8 dots per millimeter): the most common. You’ll find it on printers like the GX420, ZD410, and ZD420.
300 DPI (12 dots per millimeter): higher detail, ideal for small text and dense barcodes.
Here’s the rule that trips most people up: a label built for 203 DPI prints at half size on a 300 DPI printer, and a 300 DPI label overflows a 203 DPI printer. Always design for the resolution of the printer you’ll actually use.
Converting between the two? To move from 203 DPI to 300 DPI, multiply every dot value by 1.5. To go the other way, divide by 1.5.
Size Your Label Correctly
Two commands define your canvas:
^PW sets the print width, in dots.
^LL sets the label length (height), in dots.
To find the right values, multiply your physical label size by your printer’s DPI. Here are the most common sizes:
Label Size | 203 DPI (W × H) | 300 DPI (W × H) |
2" × 1" | 406 × 203 | 600 × 300 |
4" × 2" | 812 × 406 | 1200 × 600 |
4" × 6" | 812 × 1218 | 1200 × 1800 |
A clean starting template for a 4" × 2" label at 203 DPI looks like this:
^XA
^PW812 ^FX 4 inches wide at 203 DPI ^FS
^LL406 ^FX 2 inches tall at 203 DPI ^FS
^LH0,0 ^FX label home (top-left origin) ^FS
... your content ...
^XZ
Comment as you go. ^FX is the comment command. Anything between ^FX and ^FS is ignored by the printer, so leave yourself notes. Future you will be grateful when it’s time to update a template.
Dial In Print Density (Darkness)
Print density (also called darkness) controls how much heat the printhead applies. Too light and your barcodes fade and won’t scan. Too dark and the print bleeds, fills in fine detail, and shortens your printhead’s life. The sweet spot is the lowest darkness that still gives you crisp, solid blacks.
Two commands control it:
~SD sets darkness directly, on a scale of 0–30. Around 20–25 is a solid starting point for most labels.
^MD adjusts darkness relative to the printer’s saved setting, from -30 to 30.
^XA
~SD22
... your content ...
^XZ
Test and nudge. Print a label, scan it, and adjust in small steps. When barcodes scan on the first try and text edges look clean (not fuzzy, not filled in), you’re dialed in.
Set the Right Print Speed
Print speed is measured in inches per second (IPS) and set with ^PR. Most desktop Zebra printers run between 2 and 6 IPS. Speed and quality pull against each other:
Slower speeds (2–3 IPS) give darker, crisper output. Best for small text, dense barcodes, and high-detail labels.
Faster speeds (5–6 IPS) move more labels per minute but can soften edges and lighten barcodes.
A common fix: if you need the speed, bump darkness up a notch or two to keep barcodes sharp.
^XA
^PR4 ^FX 4 inches per second ^FS
~SD24
... your content ...
^XZ
Place & Center Your Content
ZPL positions everything from the top-left corner of the label, measured in dots:
^FO x,y sets the field origin (the top-left point of an element).
^FD ... ^FS holds the actual content (field data), closed by a field separator.
To center text, skip the manual math and use a field block (^FB). It wraps text inside a width you define and handles justification for you:
^FO0,40^FB812,1,0,C^A0N,30,30^FD{{ PRODUCT_NAME }}^FSThat centers PRODUCT_NAME across the full 812-dot width (the C is for center).
Centering a barcode is trickier, because its width depends on how many characters it encodes. The reliable approach: preview in Labelary (more on that below), read off the rendered width, and adjust your ^FO x-value until it’s centered. For fixed-length values, once you’ve centered one, the rest line up.
Barcodes & QR Codes Done Right
LASSO labels commonly use two barcode types.
Code 128 (a linear barcode) is the workhorse for asset IDs and serial numbers:
^BY2,2,90 ^FX module width, ratio, height ^FS
^FO40,55^BCN,90,Y,N,N^FD{{ BARCODE_VALUE }}^FS
^BY sets the bar width, ratio, and default height.
^BC creates the Code 128. That first Y prints the human-readable number underneath.
QR codes pack a lot of data into a small square, perfect for linking to a record:
^FO480,140^BQN,2,7^FDMA,{{ ASSET_SERIAL }}^FSThe 7 is the magnification (1–10). Bigger number, bigger QR code.
The MA sets the error correction level (M) and input mode (A).
Two tips that save the most headaches:
Leave a quiet zone. Every barcode needs clear, empty space around it, with no text or borders crowding in, or scanners struggle. Give it room to breathe.
Raise error correction for rough environments. If labels get smudged, scuffed, or torn out in the warehouse, bump the QR error correction from L (~7%) or M (~15%) up to Q (~25%) or H (~30%). The code gets a little denser but keeps scanning even when damaged.
Adding a Logo
ZPL can’t read a color PNG or JPG directly. Logos have to be converted to a one-color (monochrome) bitmap first. You’ve got two ways to get a logo onto the label:
Store it on the printer (best for repeated use). Convert your logo to a monochrome image, upload it to the printer’s memory with Zebra’s free Setup Utilities as a .GRF file, then recall it:
^FO150,80^XGR:LOGO.GRF,1,1^FS
Embed it directly in the ZPL. Convert the logo to a ^GF (graphic field) hex block and drop it straight into your label file. This keeps everything self-contained but makes the file larger.
Start simple. For a clean conversion, begin with a high-contrast, simple version of your logo. Fine gradients and thin lines don’t survive the jump to one color.
Preview Before You Print
This is the single biggest time-saver: preview your ZPL before you send it to a printer. Labelary (labelary.com) is a free online viewer. Paste in your ZPL, set the DPI and label size to match your printer, and see exactly what will print. No wasted labels, no guesswork.
Make Labelary your first stop every time you change a layout. It’ll catch sizing and positioning issues in seconds.
Common Pitfalls to Avoid
Wrong DPI. Designing at one resolution and printing at another is the number one cause of half-size or oversized labels.
A missing ^FS. Every field needs a field separator to close it. Miss one and the rest of your label can collapse into a jumble.
Crowding the barcode. No quiet zone means no scan. Keep borders and text clear of your barcodes.
Set-and-forget density. As your labels and ribbons change, revisit your darkness. What looked perfect last month may need a small tweak.
No comments. Use ^FX to leave notes in your ZPL so the next person (or future you) can update the template without guessing.
Quick Reference Cheat Sheet
Keep this handy. These are the commands you’ll reach for most:
Command | What It Does |
^XA / ^XZ | Start and end every label |
^PW | Print width, in dots |
^LL | Label length / height, in dots |
^LH | Label home (origin offset) |
^FO x,y | Field origin (top-left of an element) |
^FD ... ^FS | Field data and field separator |
^FB | Field block (wrapping & centering) |
^A0N,h,w | Scalable font (height × width in dots) |
^CF | Change the default font |
^BY | Barcode defaults (width, ratio, height) |
^BC | Code 128 barcode |
^BQ | QR code |
^GB | Graphic box (borders & lines) |
^GF / ^XG | Embed or recall a graphic (logo) |
~SD | Set darkness (0–30) |
^MD | Adjust darkness (from -30 to 30) |
^PR | Print speed (inches per second) |
^CI28 | UTF-8 character encoding |
^FX ... ^FS | Comment (ignored by the printer) |
Troubleshooting
Template is not printing correctly
Elements are printing too large/running off the sides of the label, or are printing too small
This is usually due to a resolution issue between the template and printer itself. Most common Zebra printer resolutions are 203 dpi and 300 dpi. The included template within LASSO is configured for 300 dpi. If your barcode printer has a different resolution, you may need to re-configure label templates to display properly.
Content is cut off or shifted into the margins
Recalibrate the barcode printer. Follow the instructions in your barcode printer manual.
The text elements are not properly configured to "wrap" to a new line.
The template does not have margins set for label tape vs. the label itself. Adjust the position values of the elements in the template correctly.
Need a Hand?
Designing your first few labels takes a little trial and error, and that’s completely normal. Preview often, change one thing at a time, and lean on the cheat sheet above. If you get stuck or want a label template built to your exact spec, your Customer Success Manager is here to help. You can also find more setup guides at help.lasso.io.
