npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

aamva-parser

v1.6.0

Published

Parse AAMVA PDF417 barcode data from US and Canadian driver's licenses and ID cards. TypeScript-ready, zero dependencies.

Readme

aamva-parser

npm version npm downloads TypeScript License: ISC

Parse AAMVA PDF417 barcode data from US and Canadian driver's licenses and ID cards. TypeScript-ready, zero dependencies.

Supports AAMVA versions 1-12 (CDS 2000-2025). Built-in helpers for age verification, name formatting, and CDL detection.

Requirements

  • Node.js >= 20

Installation

npm install aamva-parser

Usage

ES Modules

import { parse, isExpired, getVersion, getAge, isUnder21, getFullName } from "aamva-parser";

// Parse the PDF417 barcode data
const license = parse(barcodeData);

console.log(license.firstName);    // "JOHN"
console.log(license.lastName);     // "PUBLIC"
console.log(license.dateOfBirth);  // Date object
console.log(license.expirationDate); // Date object
console.log(license.expired);      // false

// Quick helpers
const age = getAge(barcodeData);        // 56
const under21 = isUnder21(barcodeData); // false
const name = getFullName(barcodeData);  // "JOHN QUINCY PUBLIC"

// Check if license is expired
const expired = isExpired(barcodeData); // boolean

// Get AAMVA version
const version = getVersion(barcodeData); // "08"

CommonJS

const { parse, isExpired, getVersion } = require("aamva-parser");

const license = parse(barcodeData);

TypeScript

import {
  parse,
  ParsedLicense,
  Gender,
  EyeColor
} from "aamva-parser";

const license: ParsedLicense = parse(barcodeData);

if (license.gender === Gender.Male) {
  console.log("Male");
}

if (license.eyeColor === EyeColor.Brown) {
  console.log("Brown eyes");
}

API

parse(barcodeData: string): ParsedLicense

Parses the raw PDF417 barcode string and returns a ParsedLicense object with all extracted fields.

getVersion(barcodeData: string): string | null

Returns the AAMVA version number (e.g., "08" for version 8).

isExpired(barcodeData: string): boolean

Returns true if the license expiration date has passed.

getAge(barcodeData: string): number | null

Returns the person's age in years, calculated from date of birth. Returns null if no date of birth is present.

isUnder21(barcodeData: string): boolean

Returns true if the person is under 21. Returns false if 21+ or if no date of birth is present.

isUnder18(barcodeData: string): boolean

Returns true if the person is under 18. Returns false if 18+ or if no date of birth is present.

isAcceptable(barcodeData: string): boolean

Returns true if the license is not expired, has been issued, and contains all required fields (name, address, dates, document ID).

getFullName(barcodeData: string): string | null

Returns the full name formatted as "FIRST MIDDLE LAST". Omits middle name if not present. Returns null if no name fields exist.

getState(barcodeData: string): string | null

Returns the state/jurisdiction code (e.g., "CA", "TX"). Returns null if not present.

isCDL(barcodeData: string): boolean

Returns true if the license is a Commercial Driver's License (v12/CDS 2025 only).

Deprecated Functions

The following PascalCase functions still work but are deprecated. Use the camelCase versions instead:

| Deprecated | Use Instead | |:-----------|:------------| | Parse() | parse() | | GetVersion() | getVersion() | | IsExpired() | isExpired() |

Supported Fields

| Field | Type | Attribute | |:------|:-----|:----------| | First Name | string | firstName | | Last Name | string | lastName | | Middle Name | string | middleName | | Expiration Date | Date | expirationDate | | Issue Date | Date | issueDate | | Date of Birth | Date | dateOfBirth | | Gender | Gender | gender | | Eye Color | EyeColor | eyeColor | | Hair Color | HairColor | hairColor | | Height (inches) | number | height | | Weight (lbs) | string | weight | | Street Address | string | streetAddress | | Street Address Line 2 | string | streetAddressSupplement | | City | string | city | | State | string | state | | Postal Code | string | postalCode | | Driver's License ID | string | driversLicenseId | | Document ID | string | documentId | | Issuing Country | IssuingCountry | country | | Name Suffix | NameSuffix | suffix | | First Name Truncation | Truncation | firstNameTruncation | | Middle Name Truncation | Truncation | middleNameTruncation | | Last Name Truncation | Truncation | lastNameTruncation | | Place of Birth | string | placeOfBirth | | Audit Information | string | auditInformation | | Inventory Control Number | string | inventoryControlNumber | | First Name Alias | string | firstNameAlias | | Last Name Alias | string | lastNameAlias | | Suffix Alias | string | suffixAlias | | CDL Indicator | string | cdlIndicator | | Non-Domiciled Indicator | string | nonDomiciledIndicator | | Enhanced Credential Indicator | string | enhancedCredentialIndicator | | Permit Indicator | string | permitIndicator | | Is Expired | boolean | expired | | AAMVA Version | string | version | | Raw Barcode Data | string | pdf417 |

AAMVA Version Support

| CDS Version | Year | Barcode Version | Supported | |:------------|:-----|:----------------|:----------| | 2000 | 2000 | 01 | Yes | | 2003 | 2003 | 02 | Yes | | 2005 | 2005 | 03 | Yes | | 2009 | 2009 | 04-05 | Yes | | 2010 | 2010 | 06 | Yes | | 2011 | 2011 | 07 | Yes | | 2012 | 2012 | 08 | Yes | | 2013 | 2013 | 09 | Yes | | 2016 | 2016 | 10 | Yes | | 2020 | 2020 | 11 | Yes | | 2025 | 2025 | 12 | Yes |

Example

Raw PDF417 Barcode Data (Version 8)

@

ANSI 636026080102DL00410288ZA03290015DLDAQD12345678
DCSPUBLIC
DDEN
DACJOHN
DDFN
DADQUINCY
DDGN
DCAD
DCBNONE
DCDNONE
DBD08242015
DBB01311970
DBA01312035
DBC1
DAU069 in
DAYGRN
DAG789 E OAK ST
DAIANYTOWN
DAJCA
DAK902230000
DCF83D9BN217QO983B1
DCGUSA
DAW180
DAZBRO
DCK12345678900000000000
DDB02142014
DDK1
ZAZAAN
ZAB
ZAC

Parsed Result

{
  firstName: "JOHN",
  lastName: "PUBLIC",
  middleName: "QUINCY",
  dateOfBirth: Date("1970-01-31"),
  expirationDate: Date("2035-01-31"),
  issueDate: Date("2015-08-24"),
  gender: "Male",
  eyeColor: "Green",
  hairColor: "Brown",
  height: 69,
  weight: "180",
  streetAddress: "789 E OAK ST",
  city: "ANYTOWN",
  state: "CA",
  postalCode: "902230000",
  driversLicenseId: "D12345678",
  documentId: "83D9BN217QO983B1",
  country: "United States",
  inventoryControlNumber: "12345678900000000000",
  expired: false,
  version: "08"
}

AAMVA Element IDs by Version

Bold = Mandatory field | -- = Not included in version

| Field | v1 | v2 | v3 | v4 | v5 | v6 | v7 | v8 | v9 | v10 | v11 | v12 | |:------|:--:|:--:|:--:|:--:|:--:|:--:|:--:|:--:|:--:|:---:|:---:|:---:| | First Name | DAC | DCT | DCT | DAC | DAC | DAC | DAC | DAC | DAC | DAC | DAC | DAC | | Last Name | DAB | DCS | DCS | DCS | DCS | DCS | DCS | DCS | DCS | DCS | DCS | DCS | | Middle Name | DAD | DAD | DAD | DAD | DAD | DAD | DAD | DAD | DAD | DAD | DAD | DAD | | Expiration Date | DBA | DBA | DBA | DBA | DBA | DBA | DBA | DBA | DBA | DBA | DBA | DBA | | Issue Date | DBD | DBD | DBD | DBD | DBD | DBD | DBD | DBD | DBD | DBD | DBD | DBD | | Date of Birth | DBB | DBB | DBB | DBB | DBB | DBB | DBB | DBB | DBB | DBB | DBB | DBB | | Gender | DBC | DBC | DBC | DBC | DBC | DBC | DBC | DBC | DBC | DBC | DBC | DBC | | Eye Color | DAY | DAY | DAY | DAY | DAY | DAY | DAY | DAY | DAY | DAY | DAY | DAY | | Height | DAU | DAU | DAU | DAU | DAU | DAU | DAU | DAU | DAU | DAU | DAU | DAU | | Street Address | DAG | DAG | DAG | DAG | DAG | DAG | DAG | DAG | DAG | DAG | DAG | DAG | | City | DAI | DAI | DAI | DAI | DAI | DAI | DAI | DAI | DAI | DAI | DAI | DAI | | State | DAJ | DAJ | DAJ | DAJ | DAJ | DAJ | DAJ | DAJ | DAJ | DAJ | DAJ | DAJ | | Postal Code | DAK | DAK | DAK | DAK | DAK | DAK | DAK | DAK | DAK | DAK | DAK | DAK | | License ID | DBJ | DAQ | DAQ | DAQ | DAQ | DAQ | DAQ | DAQ | DAQ | DAQ | DAQ | DAQ | | Document ID | -- | DCF | DCF | DCF | DCF | DCF | DCF | DCF | DCF | DCF | DCF | DCF | | Country | -- | DCG | DCG | DCG | DCG | DCG | DCG | DCG | DCG | DCG | DCG | DCG | | Weight | -- | DAW | DAW | DAW | DAW | DAW | DAW | DAW | DAW | DAW | DAW | DAW | | CDL Indicator | -- | -- | -- | -- | -- | -- | -- | -- | -- | -- | -- | DDM | | Non-Domiciled Indicator | -- | -- | -- | -- | -- | -- | -- | -- | -- | -- | -- | DDN | | Enhanced Credential | -- | -- | -- | -- | -- | -- | -- | -- | -- | -- | -- | DDO | | Permit Indicator | -- | -- | -- | -- | -- | -- | -- | -- | -- | -- | -- | DDP |

License

ISC

Credits

Inspired by the Swift version at ksoftllc/license-parser.