AAMVA payload structure
The full byte layout, the subfile grammar, the offset and length arithmetic, and one annotated payload with every byte labelled.
The file at a glance
An AAMVA DL/ID file is a fixed-shape header followed by one or more subfiles. This
encoder emits one DL subfile. With one entry the header is 21 bytes, the
directory entry is 10 bytes, and the subfile begins at byte 31 with its two-byte
designator. The length field counts that designator and everything after it.
| Part | Bytes | Value in this implementation |
|---|---|---|
| Compliance indicator | 1 | @ (0x40) |
| Data element separator | 1 | 0x0A |
| Record separator | 1 | 0x1E |
| Segment terminator | 1 | 0x0D |
| File type | 5 | ANSI , trailing space included |
| Issuer identification number | 6 | Per jurisdiction, zero-padded |
| AAMVA version | 2 | 10 |
| Jurisdiction version | 2 | 00 |
| Number of entries | 2 | 01 |
| Directory entry: designator | 2 | DL |
| Directory entry: offset | 4 | Decimal, from byte 0 of the file |
| Directory entry: length | 4 | Decimal, counting the designator, the elements and the closing 0x0D |
0x0D. Get either wrong and a reader that trusts the field will fail even though the bytes are all present.
Header structure, byte by byte
| Offset | Length | Field | Check |
|---|---|---|---|
| 0 | 1 | Compliance indicator | 0x40 |
| 1 | 1 | Data element separator | 0x0A |
| 2 | 1 | Record separator | 0x1E |
| 3 | 1 | Segment terminator | 0x0D |
| 4 | 5 | File type | ANSI |
| 9 | 6 | Issuer identification number | Must equal the jurisdiction in DAJ |
| 15 | 2 | AAMVA version | 10 |
| 17 | 2 | Jurisdiction version | 00 |
| 19 | 2 | Number of entries | 01 |
| 21 | 2 | Directory entry: designator | DL |
| 23 | 4 | Directory entry: offset | 0031 |
| 27 | 4 | Directory entry: length | Computed, not templated |
The header ends at byte 30. Byte 31 is the first byte of the subfile: the two-byte
designator, followed immediately by the first element. The offset and the length are
not repeated inside the subfile. A second copy is read as an element, and a reader that
expects DAQ at that position parses DL0 instead.
Subfile designator grammar
The directory entry is four fields and it is always 10 bytes. The subfile it points at begins with the designator and goes straight into elements:
entry := designator 2 ASCII chars "DL" for a driver's licence
offset 4 decimal digits byte position of this designator
length 4 decimal digits 2 + len(body)
subfile := designator 2 ASCII chars repeats the entry's designator
body element*, then 0x0D
body := element* each element ends 0x0A
0x0D segment terminator
element := 3 ASCII characters AAMVA element identifier
value uppercase; only DAK is padded
The designator value space is not just DL: ID is used for an
identification card subfile. This encoder always emits DL, matching the DL
subfile it builds. A reader that expects ID for a non-driver credential will
not find it here.
Offset and length, worked line by line
Take a California record. The header is 31 bytes because every field in the table above
is present and fixed-width. The body is the concatenation of elements, each ending in
0x0A, plus the final 0x0D.
header_len = 4 + 5 + 6 + 2 + 2 + 2 # compliance, ANSI, IIN, version, jurisdiction version, entry count
= 21
directory_len = 2 + 4 + 4 # designator, offset, length
= 10
offset = header_len + directory_len
= 31
body_len = sum(len(code) + len(value) + 1 for each element) + 1
= 275 # for the California sample below
sub_len = 2 + body_len # designator + elements + 0x0D
= 277
file_len = offset + sub_len
= 31 + 277
= 308
length_field = 0277 # zero-padded to four digits
offset_field = 0031 # zero-padded to four digits
The wrong version of this arithmetic counts the preamble as 12 bytes, producing
0430. The symbol still encodes, the checksum still passes, and a reader that
bounds the record by the length field reads two bytes of the next structure. That is the
classic silent corruption.
Element identifiers
Each element is a three-character ID, its value and a 0x0A terminator. The
subfile ends with 0x0D. Values are uppercase. DAK is
space-filled to 11 characters on v10; no other value is padded.
This is the table the encoder validates against, and it is published in full at /schema/fields.json. The per-jurisdiction IIN, required set and revision are at /schema/jurisdictions.json.
| ID | Field | Format |
|---|---|---|
DAQ | Customer ID number | alphanumeric |
DCS | Family name | up to 40, truncation flagged |
DAC | Given name | up to 40, truncation flagged |
DAD | Middle name | optional |
DBB | Date of birth | MMDDYYYY on v02+; CCYYMMDD on v01 |
DBA | Expiry date | MMDDYYYY on v02+; CCYYMMDD on v01 |
DBD | Issue date | MMDDYYYY on v02+; CCYYMMDD on v01 |
DBC | Sex | 1 male, 2 female, 9 unspecified |
DAG | Street address | alphanumeric |
DAI | City | alphanumeric |
DAJ | Jurisdiction code | 2 letters, derived from state |
DAK | Postal code | 5 or 9 digits, space-filled to 11 on v10 |
DCF | Document discriminator | jurisdiction-assigned |
DCK | Inventory control number | jurisdiction-assigned |
DDA | Compliance type | F or N |
DDB | Card revision date | CCYYMMDD |
DDD | Limited duration flag | 1 or 0 |
DDE DDF DDG | Name truncation | T or N |
DDK | Organ donor indicator | 0 or 1 |
DDL | Veteran indicator | 0 or 1 |
Truncation semantics: DDE, DDF, DDG
DDE is the family name, DDF the given name and
DDG the middle name. Each holds T when the value on the card is
longer than the value stored in the symbol, and N when it fits.
The flag is the only signal a reader gets that a name was cut. A 42-character family name
stored as 40 characters with DDE=N is not a cosmetic issue: the reader
reports a complete name that is two characters short, and any downstream comparison
against the card fails without explaining why. If your source data can exceed the cap,
derive the flag from the source length, not from the value you sent.
DCF: the document discriminator
DCF is a jurisdiction-assigned value that changes when the card is reissued.
It is not derived from the licence number, the date of birth or the expiry date. The
common defect is copying DCF from a sample payload: the symbol is
structurally perfect and identifies the wrong document.
The same rule applies to DCK, the inventory control number. Both are
assigned by the jurisdiction. The API can mint a deterministic placeholder when
generate.dd or generate.icn is set: a 12-character DCF from
A-Z 2-9 with I, O, 0 and
1 removed, and a 12-digit DCK. That placeholder is suitable for fixtures
and is not the identifier printed on the card. An explicit value always wins.
DDA: the compliance flag
DDA is F for a REAL ID compliant card and N for a
non-compliant one. It is a copy of the card's status, not a property you can infer from
the presence of an address or a photograph. A reader may treat the two values
differently, so a wrong flag changes the meaning of the credential without breaking the
symbol.
An annotated sample payload
Control characters are shown as glyphs: ␊ is 0x0A,
␞ is 0x1E, ␍ is 0x0D.
The offsets below are byte positions in the encoded file.
offset 0 @ compliance indicator
offset 1 ␊ data element separator
offset 2 ␞ record separator
offset 3 ␍ segment terminator
offset 4 ANSI file type marker, 5 bytes with space
offset 9 636014 IIN, California
offset 15 10 AAMVA version
offset 17 00 jurisdiction version
offset 19 01 one entry
offset 21 DL directory: subfile designator
offset 23 0031 directory: subfile offset
offset 27 0277 directory: subfile length
offset 31 DL subfile designator, not repeated
offset 33 DAQ 1234567 ␊ customer ID
offset 44 DCS SAMPLE ␊ family name
offset 54 DAC JORDAN ␊ given name
offset 64 DBB 03141990 ␊ date of birth, MMDDYYYY
offset 76 DBA 01152030 ␊ expiry date
offset 88 DBC 1 ␊ sex
offset 93 DAG 1234 SAMPLE ST ␊ street
offset 111 DAI BEVERLY HILLS ␊ city
offset 128 DAJ CA ␊ jurisdiction code
offset 134 DAK 90210 ␊ postal code, space-filled to 11
offset 149 DCF QHCHQ8WX3J83 ␊ document discriminator
offset 165 DCK 123456789012 ␊ inventory control number
offset 181 DCA C ␊ vehicle class
offset 186 DCB NONE ␊ restrictions
offset 194 DCD NONE ␊ endorsements
offset 202 DDA F ␊ compliance type
offset 207 DDB 01012020 ␊ card revision date
offset 219 DDD 1 ␊ limited duration
offset 224 DDE N ␊ family name truncation
offset 229 DDF N ␊ given name truncation
offset 234 DDG N ␊ middle name truncation
offset 239 DBD 01152024 ␊ issue date
offset 251 DAY BRO ␊ eye colour
offset 258 DAU 070 IN ␊ height
offset 268 DCG USA ␊ country
offset 275 DDK 0 ␊ organ donor indicator
offset 280 DDL 0 ␊ veteran indicator
offset 285 DAD A ␊ middle name
offset 290 DAZ BRO ␊ hair colour
offset 297 DAW 165 LB ␊ weight
offset 307 ␍ segment terminator
Two checks catch almost every defect on this structure. First, the two bytes at the
offset field must be DL; if they are not, the offset is wrong. Second,
offset + length must equal the total byte count; if it does not, the length
was measured from the wrong place.
Verify a payload
Paste a payload into the barcode inspector for a byte table, IIN lookup and a pass or fail per rule. For the substrate side of the same problem, read error correction.