GTIN fundamentals

GTIN Test Vectors: Check Digit CSV & JSON

Short answer: GTIN validation test vectors are known inputs paired with expected format, checksum and normalization results. ProductPassKit provides 30 synthetic examples in reusable CSV and JSON formats so developers can test GTIN-8, GTIN-12, GTIN-13 and GTIN-14 implementations without using live product catalogues.

Published by ProductPassKitPublished 2026-10-285 min read

Download GTIN checksumming fixtures

These files are text-based, self-contained and reusable in automated tests. They contain 30 synthetic records created by ProductPassKit—not product registrations or GTIN allocation records.

Download GTIN test vectors (JSON) · Download GTIN test vectors (CSV)

Permanent URLs: /datasets/gtin-validation-test-vectors.json and /datasets/gtin-validation-test-vectors.csv. Link directly to this guide for the test descriptions and limitations.

Coverage: valid, invalid and malformed identifiers

The dataset includes three positive examples and three check-digit mismatch examples for each of the four GTIN formats (24 rows), plus six edge cases. That covers GTIN-8, GTIN-12, GTIN-13, GTIN-14, nonnumeric input, unsupported lengths, empty input, accepted separators and a leading-zero UPC case.

ExampleExpected resultUse it to test
96385074GTIN-8, structurally validLength and check digit
96385075GTIN-8, checksum mismatchExpected digit 4
036000291452GTIN-12, structurally validPreserving leading zeroes
4006381333931GTIN-13, structurally validNormalization to 04006381333931
4006381333932GTIN-13, checksum mismatchExpected digit 1

How to use the vectors in automated tests

  1. Read the JSON vectors array, or import the CSV as text to preserve leading zeroes.
  2. For each input, compare your result with expected_valid, expected_type, expected_check_digit and expected_gtin14.
  3. For negative cases, ensure your validation rejects the input without asserting identifier ownership.
  4. Run an independent standards-aligned implementation to verify arithmetic rather than blindly trusting one code path.

The field reason provides the expected diagnostic category. expected_gtin14 is null for invalid examples. expected_check_digit can also be null where no supported numeric format was detected.

Do not confuse a padded representation with a new GTIN-14

For GTINs shorter than 14 digits, leading filler zeroes can be added for fixed-length fields. A padded GTIN-12 remains the same GTIN-12 identity represented in a 14-character field. It is not newly allocated as a packaging-level GTIN-14.

CSV readers should import identifiers as strings. Spreadsheet numeric conversion can strip leading zeros before the validator even receives the original identifier.

Limitations and appropriate use

All provided numbers are synthetic test cases and must not be used as real product identifiers. Arithmetic success does not establish GS1 issuance, licensing, company ownership, assignment or barcode print quality. This dataset is a regression-testing aid, not a certification suite or substitute for the normative GS1 specification.

To explore an input interactively, use the single GTIN validator, or upload the CSV to the bulk GTIN checker.

Sources and standards

Technical statements in this guide are grounded in current GS1 primary sources. The explanations are paraphrased for practical use.