A Go library and CLI tool for decoding Vehicle Identification Numbers (VINs) based on the ISO 3779 standard.
- VIN Validation: Validates VIN format, character set, and check digit
- Complete Decoding: Extracts all standardized VIN components:
- World Manufacturer Identifier (WMI) - manufacturer, country, geographic area
- Vehicle Descriptor Section (VDS) - manufacturer-specific codes and check digit
- Vehicle Identifier Section (VIS) - model year, plant code, serial number
- Extensive Database: Includes 8000+ manufacturer codes (WMI)
- CLI Tool: Command-line interface for easy VIN decoding
go get github.com/way-platform/vin-gogo install github.com/way-platform/vin-go/cmd/vin@latestOr download prebuilt binaries from the Releases page.
package main
import (
"fmt"
"log"
"github.com/way-platform/vin-go"
)
func main() {
vinStr := "1HGBH41JXMN109186"
decoded, err := vin.Decode(&vinStr)
if err != nil {
log.Fatalf("Failed to decode VIN: %v", err)
}
fmt.Printf("Manufacturer: %s\n", decoded.WMI.Manufacturer)
fmt.Printf("Country: %s\n", decoded.WMI.Country)
fmt.Printf("Model Year: %s\n", decoded.VIS.ModelYear)
fmt.Printf("Serial Number: %s\n", decoded.VIS.SerialNumber)
}Decode a VIN and display the results as JSON:
vin decode 1HGBH41JXMN109186Output:
{
"vin": "1HGBH41JXMN109186",
"wmi": {
"code": "1HG",
"manufacturer": "Honda",
"country": "United States",
"geographic_area": "North America"
},
"vds": {
"manufacturerSpecific": "BH41J",
"checkDigit": "X",
"checkDigitValid": true
},
"vis": {
"modelYear": "2021",
"plantCode": "M",
"serialNumber": "109186"
}
}A VIN consists of 17 characters divided into three sections:
-
World Manufacturer Identifier (WMI) - Characters 1-3
- Identifies the manufacturer and country of origin
- First character indicates geographic area
-
Vehicle Descriptor Section (VDS) - Characters 4-9
- Characters 4-8: Manufacturer-specific vehicle attributes
- Character 9: Check digit for VIN validation
-
Vehicle Identifier Section (VIS) - Characters 10-17
- Character 10: Model year
- Character 11: Manufacturing plant code
- Characters 12-17: Sequential serial number
- Go 1.24 or later
- buf (automatically installed via
go installwhen needed) - Mage (optional, for build automation)
# Clone the repository
git clone https://github.com/way-platform/vin-go.git
cd vin-go
# Generate code and build (run from project root with -d tools)
go tool mage build
# The binary will be in bin/vin
./bin/vin decode 1HGBH41JXMN109186go tool mage -l- ISO 3779: International standard for VIN structure
- WMI Database: Comprehensive database of World Manufacturer Identifiers
- Model Year Codes: Standard 30-year cycle of model year codes
MIT License - see LICENSE for details.
Contributions are welcome!