How an SGTIN-96 is built
A GTIN identifies a product; an SGTIN, a serialised GTIN, adds a serial number that identifies one physical item. SGTIN-96 is the 96-bit way of writing it to the EPC memory of a UHF RFID tag, and the GS1 EPC Tag Data Standard 2.3 defines every bit of it. Here is the standard’s own example (Appendix E.1), worked through by the encoder above:
| Form | Value |
|---|---|
| GS1 element string: GTIN (01) and serial (21) | (01)09506000134352(21)6789 |
| EPC pure identity URI | urn:epc:id:sgtin:95060001343.05.6789 |
| EPC tag URI, with filter value 3 | urn:epc:tag:sgtin-96:3.95060001343.05.6789 |
| EPC in hex | 3066C4409047E14000001A85 |
From GTIN to EPC
Write the GTIN as 14 digits, adding leading zeros to a GTIN-8, GTIN-12 or GTIN-13. The first digit is the indicator digit (a pad 0 for the shorter GTINs), then come the company prefix, the item reference and the check digit. The EPC keeps the company prefix as its first field, moves the indicator digit to the front of the item reference and drops the check digit, which can be recalculated (TDS 2.3 §7.3). In the example the prefix is the 11 digits 95060001343, so the item reference field is the pad digit 0 and the item reference 5: 05. The serial is the number a GS1 element string carries after application identifier (21).
The 96 bits, field by field
| Field | Bits | Binary | Value |
|---|---|---|---|
| Header | 8 | 00110000 | 30 (hex)SGTIN-96 |
| Filter value | 3 | 011 | 3Reserved |
| Partition | 3 | 001 | 111-digit company prefix (37 bits), 2-digit indicator and item reference (7 bits) |
| GS1 Company Prefix | 37 | 1011000100010000001001000001000111111 | 9506000134311 digits |
| Indicator and item reference | 7 | 0000101 | 05Pad digit 0 (a GTIN-8, -12 or -13 has no indicator digit), then item reference 5 |
| Serial number | 38 | 00000000000000000000000001101010000101 | 678938-bit integer |
The header 30 says the rest is an SGTIN-96 (TDS 2.3 Table 14-1). The 3-bit filter value helps readers pick out tags, and the 3-bit partition says where the company prefix ends. The company prefix and the indicator digit and item reference are two binary integers that always share 44 bits between them, and the serial is a 38-bit integer (§14.6.1, Table 14-17). Read the 96 bits as hex, four bits per character, and you have the EPC your readers report.
The partition table
Company prefixes come in different lengths, so the partition value tells a decoder how the 44 bits are split. Count the digits of the GS1 Company Prefix, not of the GTIN, and take the row with that length (TDS 2.3 Table 14-16). “Item ref.” is the indicator digit and the item reference together:
| Partition | Prefix digits | Prefix bits | Item ref. digits | Item ref. bits |
|---|---|---|---|---|
| 0 | 12 | 40 | 1 | 4 |
| 1 | 11 | 37 | 2 | 7 |
| 2 | 10 | 34 | 3 | 10 |
| 3 | 9 | 30 | 4 | 14 |
| 4 | 8 | 27 | 5 | 17 |
| 5 | 7 | 24 | 6 | 20 |
| 6 | 6 | 20 | 7 | 24 |
The GTIN cannot tell you the length, because the same 13 digits can be split after the sixth digit or after the twelfth. That is why the tool asks for it. A wrong length does not fail: it produces a different, valid-looking EPC whose URI no longer matches the one your trading partners expect.
Filter values
The filter value lets a reader select, for example, the one pallet tag among hundreds of item tags. It is control information, not part of the EPC: the pure identity URI leaves it out, and two items must never carry the same EPC even with different filter values (TDS 2.3 §10). The SGTIN values are (Table 10-1):
| Value | Meaning |
|---|---|
| 0 | All Others |
| 1 | Point of Sale (POS) Trade Item |
| 2 | Full Case for Transport |
| 3 | Reserved (for GS1 to assign later; do not write it to tags, §10.1) |
| 4 | Inner Pack Trade Item Grouping for Handling |
| 5 | Reserved (for GS1 to assign later; do not write it to tags, §10.1) |
| 6 | Unit Load |
| 7 | Unit inside Trade Item or component inside a product not intended for individual sale |
Use the value that describes the tagged object; the standard’s example uses 3, a reserved value. If your retailer or trading partner publishes a tagging guideline, it says which value to use.
Serial numbers
An SGTIN-96 serial is a whole number from 0 to 274,877,906,943 (238 − 1), with no leading zeros (TDS 2.3 §14.6.1). If every serial must have the same number of digits, start from a power of ten: for 12-digit serials, use 100,000,000,000 to 274,877,906,943 (§12.3.1). A serial with letters, symbols or leading zeros needs SGTIN-198 or a newer TDS scheme such as SGTIN+, which this tool does not encode.
Whether serials run in sequence or are drawn at random, and which range each supplier or production run uses, is the brand owner’s decision or the retailer programme’s rule. Whatever the policy, a GTIN and serial identify one item only: never issue the same pair twice, across suppliers and across orders.
Pure identity URI or tag URI?
The pure identity URI, urn:epc:id:sgtin:…, is the EPC itself: company prefix, item reference and serial (TDS 2.3 §6.3.1). It is the form recommended for business applications and the “what” of EPCIS visibility data (§3); since EPCIS 2.0, a GS1 Digital Link URI such as https://id.gs1.org/01/09506000134352/21/6789 is accepted as an equivalent (§4.4, Table 14-17). The tag URI, urn:epc:tag:sgtin-96:…, adds the filter value and names the 96-bit coding scheme, so it describes what is written to the tag (§12). For an SGTIN-96 without other control fields, converting one to the other adds or removes just those two details (§12.3.2 and §12.3.3).
GTINs that cannot become an SGTIN
A GTIN-8 is encoded with an 8-digit company prefix made of five zeros and the GTIN-8’s first three digits (§7.3.2). The standard excludes some number ranges from SGTINs altogether, and the tool refuses them (§7.3.3 to §7.3.7): restricted circulation numbers (RCN-8, and GS1 prefixes 02 and 20 to 29, used for example for variable-measure items), company internal numbering (04 and 0001 to 0007), coupons (981 to 984 and 99) and refund receipts (980). It also refuses ISSNs, the GTINs of serial publications (977), because an SGTIN cannot currently be made from one (§7.3.8.2). ISBNs and ISMNs (978 and 979) can be encoded (§7.3.8.1).
Writing the EPC to a tag
The hex is the content of the tag’s EPC memory bank from bit 20h onward. The protocol control (PC) word in front of it declares the EPC length, which for 96 bits is six 16-bit words, and the CRC before that is normally calculated by the reader (TDS 2.3 §15.1.1, Table 15-1). The length in the PC word tells the tag how many 16-bit words of EPC to send when a reader inventories it (Gen2 standard §6.3.2.1.2.2), so check it when you write 96-bit EPCs yourself. The four memory banks of a UHF tag are explained in RFID Data Encoding and Memory Structures.
Other 96-bit GS1 schemes
The same header-first layout carries other GS1 keys, each with its own header: 31 for SSCC-96, 32 for SGLN-96, 33 for GRAI-96 and 34 for GIAI-96 (Table 14-1). SSCC-96 identifies a logistic unit such as a pallet, SGLN-96 a location, GRAI-96 a returnable asset and GIAI-96 an individual asset. This tool encodes and decodes SGTIN-96 only; paste another scheme into Decode and it names the scheme from its header. Which scheme fits each level of a supply chain is covered in RFID Supply Chain Management: Tags, Encoding and EPCIS.