PDF417 generator

The stacked barcode on driver's licenses, boarding passes and shipping labels. Not a square matrix read as a grid, but a stack of rows, each a linear barcode in its own right, which is why a laser scanner can sweep it one row at a time.

A stack of rows, not a grid

This is the structural difference that explains everything else about PDF417. A Data Matrix or a QR code is a single two-dimensional pattern; you have to locate the whole symbol and read it as one grid. A PDF417 is a stack of independent rows, each opening with the same start pattern and closing with the same stop pattern, so a scanner can read one row at a time and assemble them afterward.

That is why a PDF417 is wide and short, and why it should stay that way. It is also why the symbology tolerates a symbol split across a fold or read from two passes: every row carries indicator codewords saying which row it is and how many rows and columns the symbol has, so rows arriving out of order can still be put back together.

Three ways to pack your data, chosen for you

PDF417 has three compaction modes and the difference between them is large. Text packs two characters into one codeword using four sub-alphabets, so ordinary text costs half a codeword per character. Numeric converts up to 44 digits at a time into base 900, which is tighter still for long numbers. Byte packs six arbitrary bytes into five codewords, and is what non-ASCII input falls back to.

Choosing between them per run of input is what makes a symbol small, and it is a planning problem rather than a setting. This page does it for you: a long digit run goes to Numeric once it is long enough to repay its own mode switch, text the sub-alphabets cover goes to Text, and anything else goes to Byte.

One detail worth knowing if you are testing a reader: numeric compaction prefixes each chunk with a 1 before converting to base 900, and that prefix is what preserves leading zeros. Without it, 007 and 7 become the same number. A reader that returns a number with leading zeros stripped has a real bug, and encoding 0000000000000 here is how you find it.

Error correction, at nine levels

PDF417's error correction is Reed-Solomon over GF(929), a prime field rather than the byte fields QR and Data Matrix use. There are nine levels, and the number of check codewords doubles at each one: 2 at level 0 up to 512 at level 8. This page picks a level from the size of your data, because a constant is the wrong answer in both directions. Two check codewords on a 500-codeword symbol is decoration, and 512 will not fit in a small one at all.

The practical value of a high level is not just tolerating damage; it is tolerating a scanner that misses rows. A driver's license gets bent, wiped and read at an angle for years, which is a large part of why this symbology was chosen for them.

Where it beats a QR code, and where it does not

How this encoder came to exist

PDF417 was missing from this site for a long time, and for a specific reason: every codeword is one of 2,787 seventeen-module patterns, and that set cannot be derived. 10,480 patterns satisfy the symbology's structural rule and only a selected subset is used. Guessing it would have produced a generator that worked for most payloads and failed for some, which is worse than not offering PDF417 at all.

The table was eventually obtained by measurement rather than transcription, and every pattern was checked three ways that are independent of how it was found: against the 17-module rule, against the cluster its own bar widths imply, and for distinctness from every other pattern in its cluster. Then the finished encoder was put through an independent decoder across every compaction mode, the boundaries between them, and the leading-zero cases. That is the standard every symbology here is held to, and it is why this one took a while.

Questions

Is PDF417 the barcode on a driver's license?

In the United States and Canada, yes. The AAMVA standard puts a PDF417 on the back of the license carrying the name, address, date of birth and license details as delimited text. This page will encode data in that shape, though the issuing authority's exact field layout is its own specification.

How much data can a PDF417 hold?

928 codewords in the largest symbol, error correction included. Measured from this encoder, that is 1,850 characters of text or 2,710 digits. Ask for more and you get an error naming the limit rather than a symbol that cannot be read.

Why is my PDF417 so wide?

Because that is the shape it is meant to be. The encoder aims for a symbol roughly twice as wide as it is tall, which is what laser scanners are built for. If you need something squarer for the space you have, Data Matrix or a QR code is the better symbology rather than a squeezed PDF417.

What is the difference between PDF417 and MicroPDF417?

MicroPDF417 is a compact variant with a fixed set of small sizes and its own pattern table, for when there is no room for the full symbology. It is not offered here: it needs a different table, and this site does not ship a symbology whose table it cannot verify.

Generate a PDF417 →

More barcode generators

Pharmaceutical barcode generator · Test barcode numbers · Free barcode generator · EAN-13 barcode generator · UPC barcode generator · Code 128 barcode generator · Barcode generator · QR code generator

Open the generator → · All formats