How to use the lot and batch code generator
- Choose Make codes or Read a code.
- Write a pattern from the parts {YYYY} {YY} {MM} {DD} {DDD} {PLANT} {LINE} {SEQ} and {CHK}, plus any other characters.
- Enter the production date, the plant and line codes, the first sequence number, the digits in the sequence and how many codes you need.
- Copy the codes, or enter a code to read its date and parts.
Formula
{DDD} is the day of the year, from 001 on January 1 to 365 or 366, padded to 3 digits
{YY} is the last two digits of the year. {SEQ} counts up from your first number, padded with zeros
Check character: each letter or digit is worth 0 to 35 (A is 10), multiplied by its position from 1, and the sum is taken mod 10 or mod 36
Reading a code reverses the pattern: dates have fixed widths, and plant, line and sequence use your lengths
The check character and any dashes are left out of the sum. Two-digit years from 00 to 69 are read as 2000 to 2069.
Day 60 of 2026
March 1, 2026 is day 060 (31 + 28 + 1). The pattern {YY}{DDD}-{LINE}-{SEQ} with line L2 and five codes starting at 1 gives 26060-L2-001 to 26060-L2-005. December 31, 2028 is day 366 because 2028 is a leap year, so the code starts 28366.
The pattern L{YYYY}{MM}{DD}-{LINE}{SEQ} gives L20260301-L2001. Adding {CHK} to the end of the first pattern with a mod 36 check gives 26060-L2-0018: the values of 2, 6, 0, 6, 0, L, 2, 0, 0, 1 weighted by 1 to 10 add up to 188, and 188 mod 36 = 8. Reading 26060-L2-001 back gives March 1, 2026.
Why lot codes carry a date
A lot or batch code ties a product to the day and place it was made, so a problem can be traced to the items that share it. A day-of-year number is compact and sorts in order, which is why food, medicine and electronics makers use it. A plant and a line code say where, and a sequence number separates the lots made on the same day.
A check character catches typing mistakes on the shop floor or in a database. It cannot prove that a code is real, only that it has not been mistyped.
Choosing a pattern
Keep codes the same length, avoid characters that look alike and leave room for the sequence to grow. Decide the format once and write it down, because changing it later makes old and new codes hard to read together. For other numbering use the Document Number Sequence Generator and the SKU Code Generator, to see a date as a day number the Julian Date Calculator, and to print the code as bars the Barcode Generator.
Assumptions and limits
- The plant and line codes use letters and digits only, and the pattern has at least one date or sequence part.
- The sequence must fit in the digits you choose.
- The pattern and codes shown are examples. Use your own scheme.
- Up to 500 codes are made at a time.
Frequently asked questions
What does {CHK} do?
It marks where the check character goes. Choose a check type as well, and the character is worked out from the rest of the code.
Why does reading a code fail?
The code must match the pattern and the lengths you entered, for the plant, line and sequence. The message says which part did not fit.
Can I use month and day instead of the day of the year?
Yes. Use {MM} and {DD}, or {YYYY}{MM}{DD}. Either form is read back to the same date.
Are the codes unique?
They are unique within the run you make, because the sequence changes. Uniqueness across days or plants depends on the other parts of your pattern.