Decode one
Scan or paste a barcode and see every part of it.
Make one
Generate a valid barcode from fields.
Where you’ll see it
- Driver’s licenses and ID cards in the US and Canada, carrying the holder’s details in the AAMVA format. See AAMVA test barcodes.
- Airline boarding passes, printed.
- Shipping labels and government forms that need more data than a linear barcode holds.
Anatomy
Every row has the same structure, read left to right:
A code has 3 to 90 rows.
Codewords
Every codeword is 17 modules wide and made of four bars and four spaces. That’s where the name comes from: 4 bars and spaces in 17 modules. There are 929 codeword values. Rows cycle through three different sets of patterns for the same values. A scanner can tell from the pattern which row it’s reading, so it can read a row even if its scan line drifts into the next one.Compaction
An encoder switches between three ways of packing data into codewords: text, bytes, and numbers. Long runs of digits pack most tightly. A full-size code holds up to about 1,850 text characters, 2,710 digits, or 1,108 bytes.Quiet zone
PDF417 needs a light margin at least 2 modules wide on every side.Error correction
PDF417 has nine error correction levels, 0 to 8. Each level doubles the number of error correction codewords, from 2 at level 0 to 512 at level 8. The recommended minimum depends on how much data there is:
Use the recommended minimum for codes on screens and clean documents. Go one or two levels higher for labels that get handled roughly, and print larger to keep the modules from shrinking. See How much error correction should I use?
Variants and related types
- Truncated PDF417: drops the right row indicator and shortens the stop pattern to save space. Use it only where the code won’t be damaged.
- MicroPDF417: a smaller form with 1 to 4 columns.
- Macro PDF417: splits data too large for one code across several, which a scanner joins back together.
Gotchas
- Line breaks and control characters in the data. Driver’s license data has them by design. See invisible characters.
- Personal data. A license barcode holds a name, address and date of birth. Read only what your app needs, and don’t log the raw scan.
- Hard for phone cameras when small. The rows are short, and a low-resolution camera can struggle to resolve them. Hold the camera closer, or use hardware.
Scanning it in your app
PDF417 is in the 2D and ID and documents groups.Specification
- ISO/IEC 15438: the PDF417 barcode specification.
- AAMVA DL/ID Card Design Standard: the data on North American driver’s licenses.