Reference · licence payloads
PDF417 barcode for a driver's license.
The PDF417 on the back of a US driver's license is not a barcode holding a license number. It is an AAMVA file: a 21-byte header, a directory entry with a byte offset and a length, and a DL subfile of three-letter element codes. The six-digit issuer identification number in that header is what tells a reader which jurisdiction's rules apply to everything after it.
The header, byte by byte
| Offset | Bytes | Value |
|---|---|---|
| 0 | 1 | Compliance indicator @ (0x40) |
| 1 | 3 | 0x0A 0x1E 0x0D, the LF, RS and CR separators |
| 4 | 5 | ANSI , the file type marker |
| 9 | 6 | Issuer identification number, zero-padded |
| 15 | 2 | AAMVA version, 10 in this encoder |
| 17 | 2 | Jurisdiction version, 00 except New York 04 |
| 19 | 2 | Number of subfile entries, 01 |
| 21 | 10 | DL, a four-digit offset and a four-digit length |
That makes the subfile start at byte 31. The offset and length are written once, here in
the directory. They do not appear again inside the subfile; a second copy is read as an
element called DL0 and is the most common silent corruption in
hand-assembled payloads.
A complete payload, counted
The table above reads more clearly as bytes than as description. What follows is a Texas record shortened to eight elements so the arithmetic stays visible; a real card carries the full base set of 27. Offsets are counted from the first byte of the file, and every number in the left column is the thing a reader will use to walk the structure.
000 @ compliance indicator
001 0A 1E 0D element, segment and record separators
004 ANSI file type marker
009 636014 issuer identification number, Texas
015 10 AAMVA version
017 00 jurisdiction version
019 01 one subfile entry
021 DL0031 0093 designator, offset, length
031 DAQ1234567
043 DCSAMPLE
053 DACJORDAN
063 DBB03141990
075 DBA01152030
087 DAK90210_______
102 DAJTX
108 DCFDDXK7T9MWQR
124 CR
The directory states that the subfile begins at 31 and runs for 93 bytes: 92 characters of element data plus the closing carriage return. No other byte in the file records that length. Shift either figure by one and the reader either starts parsing mid-element or truncates the last one, which is why hand-built payloads fail on their final field far more often than their first.
The file is 124 bytes before error correction. At level 4 that becomes 156 codewords, 32 of them parity, and the block needs roughly 78 rows at two columns. At a three-to-one row height and a six mil module those 78 rows measure about 35 mm, taller than a 25 mm label — so this record wants more columns before it wants more error correction.
What the reader does, in order
A verifier never reads the file first. It finds the start pattern, reads the row indicator codewords to learn how many rows and columns the symbol claims, decodes the codewords, and only then runs error correction across the whole block. If the block does not reconcile it stops, and the header is never examined. That order is the useful part when debugging: a symbol that yields nothing at all is a symbology problem, while one that decodes cleanly and is then refused is a file problem.
Once the block reconciles, the first decoded byte has to be the compliance indicator, the next nine bytes have to be the separator run and the file type marker, and the six digits after those are the IIN. The reader uses the IIN to select a jurisdiction rule set, parses the directory, jumps to the stated offset and reads elements until the segment terminator. Nothing in that sequence compares the IIN against the element set — the reader has no second opinion to offer — so a well-formed file for the wrong state passes the decoder and fails at the application layer.
What the subfile contains
The DL subfile is a sequence of element identifiers and values, each terminated by a line
feed, with the subfile closed by a carriage return. The base required set is 27 elements,
starting with DAQ (document number), DCS (family name),
DAC (first name) and the two dates of birth and expiry. New York adds
DAH; every other US row in this encoder uses the base set. The full table for
each jurisdiction is on its state page.
Three details cause most rejections. Dates are written MMDDYYYY on version
10 and later, not CCYYMMDD. DAK is fixed-width and space-filled
to eleven characters on version 10. Values are upper-cased before encoding, which changes
a lower-case discriminator even though the symbol still decodes.
Element order is not alphabetical
Identifiers are ordered by the standard, not alphabetically and not by importance:
DAQ leads because it is the document number, the names follow, the dates
follow the names, and the optional and physical-description elements trail the base set.
Readers that validate order reject a file where DAK sits ahead of
DAI even though both parse cleanly on their own. When you compare a payload
against a state page, compare position as well as presence — the
element code table lists the canonical sequence,
and the revision comparison shows where it has moved
between standard editions.
Error correction is a print decision
PDF417 error correction runs from 0 to 8, adding 2 codewords at level 0 and 512 at level 8. A driver's licence payload is dense: a full base set plus optional elements lands near 400 bytes, so raising EC adds rows rather than columns and can push the symbol past the label height. Level 5 is the working default for polycarbonate card stock, level 6 for laminate, and level 4 where the label is tight and the record short. The substrate decision table has the full matrix.
| Substrate | Typical level | Why |
|---|---|---|
| Thermal paper label | 4 | Short life, low smear, height is scarce |
| Polycarbonate card | 5 | Abrasion over years of wallet wear |
| Laminate over print | 6 | Heat and adhesive distort edges |
| Phone screen | 3 | No physical damage, display brightness varies |
| Reprint of a worn card | 6 | Inherits defects and adds its own |
Every step up costs rows, and at a fixed label height rows cost module size. Level 8 on a short label can scan worse than level 5: the parity is stronger while the grid is finer, and the grid is what the scanner actually resolves.
No error correction level fixes a symbol that has lost its start pattern to a crop or had its module grid changed by resampling. If a print fails, check density and the quiet zone before raising EC.
What makes the symbol valid
A PDF417 can be structurally perfect and still be an invalid credential: the IIN may
belong to another jurisdiction, DAJ may disagree with it, or the element
order may be wrong. Validity has two layers, the symbology and the AAMVA file, and the
conformance guide separates them. To test a finished symbol,
decode it and paste the string into the
inspector; to compare the field set with the card,
open that state's page from the index.
Why a valid symbol still gets rejected
| Symptom | Usual cause | Fix |
|---|---|---|
| Decodes, portal says invalid | DAJ contradicts the IIN | Rebuild with the state's own IIN |
| Trailing field missing | Directory length one byte short | Recount including the final CR |
| Whole record shifts left | Directory offset below 31 | Offset is fixed at 0031 |
| Reader rejects at byte 31 | DL0 duplicated into the subfile | Directory only, never the subfile |
| Dates fail validation | CCYYMMDD on a version 10 file | Rewrite as MMDDYYYY |
| Nothing decodes | Quiet zone eaten by the crop | Two modules clear on all four sides |
Questions
Can I encode a licence with any PDF417 generator?
Only if it writes an AAMVA file. A generic generator turns a string into a symbol; it does not add the header, the directory or the element set, and a verifier will decode it and then find no compliance indicator.
Why does my barcode decode but the portal call it invalid?
In order of frequency: DAJ disagrees with the IIN, DL0 was
written into the subfile as well as the directory, or a date went in as
CCYYMMDD on a version 10 file.
What error correction level should I use?
Four to five for paper, five to six for card stock. Past six the extra rows usually cost more in module size than the parity buys back.
Does the barcode have to sit on the back?
Placement is a card design choice and the file is position independent. What matters is the quiet zone and a module size the scanner can resolve.
What is DAH, and do I need it?
The organ donor indicator. New York requires it; the other 50 rows in this encoder use the base set without it.
Can I truncate the symbol to save space?
A truncated PDF417 drops the row indicators. Many readers cope, but AAMVA verifiers generally expect the full symbol, so truncate only when the label forces it.
Is the barcode the whole credential?
No. It is a machine-readable copy of the printed fields. It carries no photograph and no signature, and a verifier still compares it against the card front.
Build one
The API builds the header, the directory arithmetic and the element set from the jurisdiction record, so the request only carries the field values. The first barcode is $2.00 and is refunded if a hardware scanner will not read it. Start with the generator, or make three free symbols first to see the output before paying.