LabelNation: a command-line label-printing program

Latest version: 1.231   (30 Nov 2021)

LabelNation is a command-line program for making labels: address labels, business cards, or anything else involving regularly-arranged rectangles on a printer-ready sheet. It is for users who are comfortable dealing with text- and option-based configuration, as opposed to a graphical user interface.

LabelNation is free / open source software, written in the Python 3 programming language, and licenced under the Affero GNU General Public Licence 3.0 (AGPL-3.0).


Here's how it works: you tell LabelNation what text you want on each label. You can specify plain lines of text, or even arbitrary PostScript code. You also tell it what kind of labels it should print for. LabelNation takes all this information and produces a PostScript file, which you then send to your PostScript printer (or through a filter such as GNU GhostScript). Of course, there must be a sheet of peel-off labels in the paper tray. Such sheets are widely available at office supply stores. Two companies that offer it are Avery Dennison and Maco. This is not a recommendation nor an endorsement; Avery and Maco are simply the names I've seen.

There's a great blog entry at explaining LabelNation usage in detail, with lots of examples and pictures.

LabelNation does automatic font resizing to fit all the lines of text on the label, supports the usual accented characters (á, à, ó, etc, from ISO 8859-1).

Supported Labels

LabelNation has built-in knowledge of the following standard label types:

  2 labels per page:           Avery-5444
  4 labels per page:           Avery-5168
  6 labels per page:           Avery-5264                             
  10 labels per page:          Avery-5263, 5663, 5963, 8163
  20 labels per page:          Avery-5161, 5261, 5661, 5961
  14 labels per page:          Avery-5162, 5262, 5662, 5962, 8162, 8252, 8462,
                                     15162, 18162, 18662
  30 labels per page:          Avery-5160, 5260, 5660, 5960, 5970, 5971, 5972
                                     5979, 5980, 6241, 6460, 6245, 8660
  80 labels per page:          Avery-5167, 5267, 5667, 6467, 8167
  10 business cards per page:  Avery-5371, Maco-LL8550
  45 labels per page:          Brady-Lasertab-52-361
  49 labels per page:          Cable-Labels-LSL-77 (or "-LS10-77S")
  84 35mm slides per page:     SlidePro, SlideScribe
  16 labels per page:          Avery-7162
  14 labels per page:          Avery-7163
  32 labels per page:          Avery-6571
  21 labels per A4 page:       Avery-7160
  24 labels per A4 page:       Avery-7159
  65 labels per A4 page:       Avery-2651, 7651
  8 labels per 10" page:       Avery-2160, Maverick-ST340817

Types not listed above are still supported — you just have to tell LabelNation what sizes the labels are, and how many per page vertically and horizontally. (And then please send in your parameters, so there will be built-in support for those labels in future releases.) This chart of common label dimensions may help.

Reporting Bugs / Contributing New Label Types / Etc

If you have a bug to report, or would like to send in parameters for a new label type, please file a ticket at

Other Programs That Do Similar Things

There seem to be a lot of open source programs that perform a similar function.

LabelGrid is an open source project to do label printing purely through web-based technologies. I haven't tried it.

GLabels "is a program for creating labels and business cards for the GNOME desktop environment. It is designed to work with various laser/ink-jet peel-off label and business card sheets that you'll find at most office supply stores." Again, haven't used it myself. offers free templates for making labels using, the open source office suite.

You might also want to try the PostScript::MailLabel Perl module. I've never used it, but it looks like it does basically the same thing. I think it can handle bar-codes too.

(This isn't open source, but: there seem to be a number of templates at Google Docs that offer label formatting essentially as an online service.)


LabelNation does not natively generate barcodes. However, the postscriptbarcode program can generate a wide variety of PostScript barcodes, and you could use it together with LabelNation (see the latter's --code-input option) to create labels with barcodes. The PostScript::MailLabel Perl module described above also apparently does barcodes.

I would welcome patches to give LabelNation native barcode support.

brought to you by red-bean