All Functions

gtin - Global Trade Item Number

The Global Trade Item Number (GTIN) comes from the family of GS1 codes and is used for tracking trade items using barcodes. Each item receives its unique GTIN number.

This function allows you to generate random random GTIN codes or partly random codes for specific manufacturers and items depending on the input parameters.

The legacy names for a GTIN are:

  • EAN - European (International) Article Number
  • UCC - Uniform Code Council
  • UPC - Universal Product Code (North American, since 1970)
  • CIP - Catalogue Item. Publication
  • JAN - Japanese Article Number
  • SSCC - Serial Shipping Container Code (this is a variant of the GTIN number

More information on GTIN.

GS1: International not-for-profit association dedicated to the development and implementation of global specifications and solutions to improve the efficiency and visibility of supply and demand chains globally and across multiple sectors.


gtin ( ) Returns a random GTIN-13 (EAN) number
gtin ( $type ) Returns a random GTIN number of type $type.
gtin ( $type, $prefill ) Returns a random GTIN number of type $type with the prefix $prefill


$type The type of GTIN number to generate. These Types are supported:
Type GTIN Aliases
8 GTIN-8 EAN-8 UCC-8
12 GTIN-12 EAN-12 UCC-12 UPC
14 GTIN-14 EAN-14 UCC-14
18 na SSCC
$prefill The prefix to be used in the GTIN number (used to define the retailer, manufacturer, collector, researcher, or other entity)


GTIN Codes

gtin() // 7495563456235
Returns a valid GTIN-13 code

gtin(8) // 18128147
Returns a valid GTIN-8 code

gtin(14,1337) // 13377923938760
Returns a valid GTIN-14 code with a manufacturer code of 1337

See also

ean - EAN International ucc - Uniform Code Council cip - Catalogue Item Publication jan - Japanese Article Number upc - Universal Product Code sscc - Serial Shipping Container Code grai - Global Returnable Asset Identifier gdti - Global Document Type Identifier gcn - Global Coupon Number