VALIDPDF417

Article · 2026-11-10

How to check an AAMVA PDF417 barcode.

Decode first. A symbol that will not decode has no header to inspect, and a symbol that decodes perfectly can still carry the wrong issuer.

1. Decode the image

Use a decoder that returns raw bytes, not a formatted card summary. A card summary hides the header, and the header is where most defects are.

bash
zbarimg --raw -q dl.png | xxd -g1 | head -n 4

Byte 0 must be 0x40 (@). Bytes 1 to 3 must be 0x0A 0x1E 0x0D. Bytes 4 to 8 must be ANSI with a trailing space. If any of that is wrong, stop: this is not an AAMVA payload and no amount of field-level checking will fix it.

2. Read the header fields

BytesValueCheck
0@Compliance indicator
1–30A 1E 0DSeparators, in this order
4–8ANSI File type marker
9–146 digitsIIN, must match DAJ
15–1610AAMVA version
17–1800Jurisdiction version
19–2001Entry count
21–22DLSubfile designator
23–264 digitsSubfile offset
27–304 digitsSubfile length

3. Recompute the offset and length

The offset is a byte position from the start of the file. Take the four digits at 23 to 26, turn them into an integer, and confirm the two bytes at that position are DL. If the designator is somewhere else, the offset is wrong.

The length is not the distance to the end of the file. It counts the subfile's two-byte designator, every element and the closing 0x0D. The offset and length are not repeated inside the subfile. So for a single-subfile payload:

arithmetic
offset   = 31                  # header length
body     = 278                 # element bytes, including the final CR
length   = 2 + body = 280
total    = offset + length = 311

If the length is 290 instead of 280, the encoder repeated the directory entry inside the subfile. That is a ten-byte overrun, the second copy parses as a DL0 element, and a reader that trusts the field reads ten bytes past the record or rejects the symbol outright.

4. Check the element set

After the two-byte designator, elements run until the 0x0D terminator. Each is a three-character ID, a value and 0x0A. Check four things:

  • Every required element for the jurisdiction is present. New York requires DAH; the other 50 do not.
  • No unknown three-character ID appears. A typo turns a value into a new element.
  • Dates are eight digits and real calendar dates.
  • Values sit inside their caps, and a truncated name has its flag set.

5. Check the truncation and compliance flags

DDE, DDF and DDG describe the family, given and middle names. T means the value on the card is longer than the value in the symbol. A truncated name with the flag at N is worse than a truncation, because the reader believes it has the full name.

DDA is the compliance type: F for a REAL ID compliant card, N otherwise. It is a copy of the card's status, not a value to derive. DDB is the card revision date and DDD is the limited duration flag.

6. Scan the print, not just the file

A file that decodes is not a card that scans. Print one at the production DPI, unscaled, on the production stock, then scan it with the reader that will be used at the counter. Print density, laminate bubbles and a quiet zone clipped by the label template all live outside the file.

For a full pass or fail list on a pasted payload, use the barcode inspector. For the rules behind each check, read AAMVA payload structure and Troubleshooting.

Checklist

  • Raw decode, not a formatted summary.
  • Header bytes 0 to 8 exactly right.
  • IIN matches the jurisdiction in DAJ.
  • Offset lands on DL; length includes the designator and the closing 0x0D.
  • Required elements present, no unknown IDs.
  • Truncation flags match the actual name lengths.
  • One physical scan at production size before the batch.
Generate barcode now