Build each lot code from the production date plus the line and shift (for example 260612-L2-S1), print it on every unit and case, and keep a record linking each lot to the ingredient lots used and the customers shipped to. Then run a mock recall: from one lot, find its ingredients and customers within a target time you set.
A lot code is only worth what sits behind it. A neat string on a label does nothing unless a person can type it into your records and see which supplier deliveries went in and which orders went out. The design work is therefore mostly about three things: a code that stays unique, records that connect it both ways, and a drill that proves the connection works before an incident forces the question.
What a lot is, in kitchen terms
A lot (also called a batch) is a quantity of product made under the same conditions, from the same ingredient lots, so that if something is wrong with one unit it is likely wrong with the others. The definition drives every decision below. A lot is not a day. If you make the same sauce in the morning with one delivery of tomatoes and in the afternoon with another, and the second delivery turns out to be contaminated, a single "Tuesday" lot would force you to recall both runs. Two lots would limit the problem to one.
So the rule is to start a new lot whenever something that matters changes: a new ingredient lot enters the recipe, the line is cleaned down, the product changes, or the shift changes hands, whichever suits how you work. Smaller lots cost a little more admin and save a great deal when something goes wrong.
Some markets set specific traceability rules, and they differ. If you have customers in the EU, the general food law (Article 18 of Regulation (EC) No 178/2002) expects you to be able to identify who supplied you and which businesses you supplied, one step back and one step forward. Other markets and certain foods have their own requirements. Check your regulator's current guidance for each market, and ask a food safety adviser or your auditor if you are unsure. For related thinking about audits, see the tutorial on what a small producer can draft with AI and must verify.

The Complete Excel Course with AI Integration
From formulas and pivot tables to Power Query, DAX, VBA and AI with Copilot, ChatGPT and Claude — hands-on from the first lesson.
By Sagnik Bhattacharya and Virginia Thorn, Primetime Emmy Award winner
Buy nowChoosing the parts of the code
Most small producers use a code made of a date, a production line or equipment, and a shift or run number. Each part earns its place by answering a question during an investigation.
| Part | Question it answers | Common choices |
|---|---|---|
| Date | When was it made? | YYMMDD (260612), or year digit plus day of the year (6163) |
| Line or equipment | Which kettle, oven or filler? | L1, L2, or K1 and K2 for kettles |
| Shift or run | Which part of the day or which batch that day? | S1 to S3, or R1, R2, R3 |
| Product (optional) | Which recipe? | Two or three letters: HS for hot sauce |
| Site (optional) | Which premises, if you have more than one? | A single letter, only if you need it |
Date formats deserve a note. YYMMDD sorts correctly in a spreadsheet and reads easily by eye, and it matches the date layout used for dates in GS1 barcodes, which is also YYMMDD. Julian day-of-year codes are shorter and common in factories, but a person has to look up what 6163 means, and mistakes at the keyboard go unnoticed. For a small producer, readable beats compact.
Rules that keep a code useful
- Use only characters that survive printing and typing. Skip the letters O and I (confused with zero and one). Avoid spaces and symbols other than a hyphen.
- Keep it fixed in length. A fixed pattern lets you spot a typo at a glance and lets a sheet validate it.
- Never reuse a code. A full YYMMDD date cannot come round again, whereas the one-digit year in a day-of-year code such as 6163 repeats every ten years, so use the full year if records or stock could last that long.
- Do not hide meaning that staff cannot read. If only one person knows what the middle digits mean, the system collapses on their day off.
- Keep the lot separate from the best-before or use-by date. They answer different questions, and the date can change independently, for instance when you repack.
- Stay within barcode limits if you plan to use them. The batch or lot field in a GS1 barcode (Application Identifier 10) allows up to 20 alphanumeric characters, so a code like 260612-L2-S1 at 12 characters fits comfortably.
Three candidate schemes, compared
When you are unsure, ask a chat assistant to propose options based on your facts, then judge them yourself. This prompt gives it what it needs without letting it invent your rules.
I make hot sauce in a small unit. Facts:
- Two kettles (K1, K2), one bottling line
- One shift per day, sometimes two
- Up to 4 batches a day, each 120 litres
- Labels printed by an inkjet that prints up to 14 characters
- Ingredients arrive weekly; chillies and vinegar come from two suppliers each
- I sell to 40 shops and online
Propose three lot code formats, each with an example, its length, how a staff member would read it, and one weakness. Do not assume any legal requirement. Say which of my facts each format relies on.
Typical returns, in illustrative form, would include a pure date code (260612), a date plus kettle plus run code (260612-K2-3), and a sequential number (L-004512). Judge them against how you work. The pure date fails because four batches a day would share a code. The sequential number is unique but says nothing to the eye. The date, kettle and run scheme tells a person who made it, where and in what order, and at 11 characters it fits the 14-character inkjet.
Linking the lot to ingredient lots
This is the half people forget. A code on the bottle tells you the finished product's identity. To trace backwards you need to know what went into it.
Receiving: give every delivery an internal number
When goods arrive, write a line in a receiving log with these fields: internal receipt number (R-2026-0412), date, ingredient, supplier, supplier's own lot or batch code, quantity, best-before or use-by date, and condition on arrival. Mark the receipt number on the container or the pallet. Supplier lot codes can repeat across products, can be blank, or can be in a format you cannot easily search, so your own number is the thing you link to.
Production: record which receipts went into each batch
The batch record lists the finished lot, date, kettle, the recipe version, and under each ingredient the receipt number used. Where a batch uses two deliveries of the same ingredient, record both and the proportion if you can. Add yield, any rework added, and the operator's initials. It also helps to note equipment cleaning before the batch if allergens changed, as covered in the tutorial on production scheduling around allergen changeovers.
Dispatch: record where each lot went
For each order, note the customer, date, product and lot, quantity. For online orders the order system can hold this, but only if the lot is entered at picking, not guessed afterwards. Many small producers close this gap with a simple rule: the picker writes the lot on the pick list and someone types it into the order record the same day.
Main example: a hot sauce maker over one week
An illustrative small producer makes three sauces on two kettles. On Wednesday 17 June 2026 it makes four batches. The lot codes follow the date, kettle and run pattern. These rows come from its batch record.
| Lot | Product | Kettle | Chilli receipt | Vinegar receipt | Litres | Bottles |
|---|---|---|---|---|---|---|
| 260617-K1-1 | Medium | K1 | R-0412 | R-0398 | 120 | 480 |
| 260617-K2-1 | Hot | K2 | R-0412 | R-0398 | 120 | 478 |
| 260617-K1-2 | Medium | K1 | R-0419 | R-0398 | 120 | 481 |
| 260617-K2-2 | Smoked | K2 | R-0419 | R-0405 | 120 | 474 |
On Friday the chilli supplier tells the owner that its lot behind receipt R-0419 may contain a foreign object. The owner searches the batch record for R-0419: two lots, 260617-K1-2 and 260617-K2-2. Then the dispatch log: the two lots, 481 and 474 bottles, went out to 11 customers between them, and 62 bottles of the first lot are still in stock. The recall scope is two lots, around 955 bottles, rather than everything made that week. Without the link, the safe choice would have been to withdraw the full week's output, eight batches or about 3,800 bottles by the same maths. The cost of the records is a few minutes a batch. The saving, in this example, is roughly three-quarters of the product.
Reconcile the numbers
For each affected lot, check that bottles made equals bottles shipped plus bottles in stock plus bottles used for samples or waste. If the sum is short by more than a few units, find the gap before you contact customers. Take the first lot: 481 made, customers took 408, stock holds 62 and samples took 6, which leaves 5 unaccounted. The owner finds that five were given away at a market stall and the sale book had no lot. That small gap is the kind of thing a drill finds in a calm moment.
Where the code goes on the product
- On every consumer unit, in the same place on every product so staff can find it. A bottle neck, base, lid or side panel works; a removable sleeve or a gift band does not.
- On outer cases and trays, in a spot visible from the front when stacked, because a customer storeroom will not open boxes to look.
- In durable print. Test that it survives chilling, condensation, handling and a wipe. Ink that smudges in a damp cold store is a classic failure.
- Next to the date, labelled. "LOT 260617-K1-1" and "BEST BEFORE 06 2027" side by side, with the word lot or its abbreviation.
- On delivery notes and invoices, so the customer's records can find it too.
When products are repacked or split, such as filling a half-litre bottle from a 5-litre container, the new unit gets its own lot, and the record links the source lot to the repack lot. Never copy a code onto a different product without writing down where the original came from. For labelling rules around allergens and legal text, see the tutorial on label design checks, which covers what a person must confirm.
Using AI to build the records, not to carry them
Four jobs suit an assistant. First, drafting the receiving log, batch record and dispatch log as spreadsheet headers with example rows. Second, writing validation formulas, such as a length check on the code. Third, converting old records (photos of handwritten batch sheets, supplier emails) into rows. Fourth, running the mock recall as a search question over a table you give it. In each case the table in your spreadsheet is the record, and the assistant is a helper that you check. A prompt for the validation rule:
My lot codes follow this pattern: six digits for date as YYMMDD, a hyphen, K1 or K2, a hyphen, and a run number from 1 to 6. Example: 260617-K1-2.
Write a Google Sheets formula that returns TRUE only when a cell holds a code in exactly that pattern, and another that extracts the date part as a real date. Explain each in one line. Then give me five codes that should fail and why.
Test the formula on the five failing codes yourself. A rule that accepts a bad code gives a false sense of safety. In an illustrative run, the assistant suggested a regular expression, then gave failing examples that included "260617-K3-1" and "26617-K1-2", which the owner entered to confirm that both returned FALSE.
A mock recall test you can run in an hour
A recall system you have never tested is a guess. Run a mock recall twice a year, and after any change to codes or records. The mock recall template tutorial has a full form; here is the outline.
- Pick a lot from the last 3 months without telling anyone which. Choose a product with many customers.
- Start the clock. Set a target time for naming every ingredient lot and every customer, with quantities reconciled, and write it down. This example uses two hours. If you hold a certification or a retailer audits you, the scheme or the customer may set its own limit, so use theirs.
- Trace backwards. Ingredients, suppliers, supplier lot codes, delivery dates.
- Trace forwards. Every customer, with dates and quantities, plus stock on hand.
- Reconcile. Made equals shipped plus stock plus waste and samples.
- Write down what was slow or missing, fix it and rerun in a month.
In the illustrative example the first drill took 3 hours 20 minutes, because dispatch lots for online orders sat in a different file and two supplier lot codes were illegible in photos. The fixes were a lot field on the online pick list and a rule to type supplier lots on the day of delivery. The second drill took 1 hour 35 minutes.
A worked rule set to paste into your procedures
Once you have chosen a format, write the rules down on one page so that every shift applies them the same way. An illustrative version for the hot sauce maker reads as follows.
- The lot code is the date as YYMMDD, the kettle (K1 or K2) and the run number for that kettle that day, joined by hyphens.
- A new run starts whenever the kettle is emptied and cleaned, an ingredient receipt number changes, or the product changes.
- The person starting a run writes the lot on the batch sheet before adding any ingredient, so the code exists before the product does.
- Every ingredient added is entered on the sheet with its internal receipt number, read from the container, never from memory.
- Labels are printed from the batch sheet by a second person, who checks the code against the sheet and signs it.
- Returned or reworked product goes into a run only with its original lot written on the sheet.
- Sealed cases carry the lot on two adjacent sides, in marker or a case label, matching the bottle.
- Every dispatch note lists the lot for each line, and the picker initials it.
- On the first Monday of each month the owner picks one lot and runs the drill in the previous section.
This list is short on purpose. If a rule needs a paragraph to explain, staff will skip it on a busy day. You can ask an assistant to turn your own wording into a laminated one-page sheet and a version for new starters, but read the result against what you really do, because the sheet becomes the standard an auditor compares you with. A procedure that describes a better process than the one you run is worse than none.
What it costs to run, and how long records should be kept
The cost of a lot system is mostly time. For the example producer it is about three minutes a batch for the sheet and a few minutes a day for dispatch lots, so around 15 minutes on a four-batch day. A label printer that can print variable text, or a lot stamp, is the main equipment cost, and that depends on the model, so check the printer maker's current price. How long to keep records depends on your product's shelf life and on the rules and customer terms that apply to you; a common practice is to keep them for the shelf life plus a margin, but confirm the period with your regulator's guidance or your adviser rather than copying a number from a web page.
Examples from other food businesses
A bakery with daily bread
Products last two days, so the lot does little for shelf life but a lot for allergens and ingredient problems. The bakery uses the date and a letter for each bake (260617-B), records flour lot per bake and sells mostly to its own shop. It still keeps a customer list for wholesale deliveries to cafés.
A coffee roaster
Roast date and roast number serve as the lot, and the green coffee bag lots are the ingredient lots. The linked tutorial on coffee roaster batch logs and wholesale orders goes deeper. A 12 kg roast may be blended with a second roast before bagging, so the bagging record must list both roast lots.
A kitchen supplying subscription boxes
Each box holds several products from different lots. The packing record lists the lot of every item in every box number or in every box type for that dispatch day. Where that is impractical, record the lots in use on the packing bench that day, and keep a rule that a lot changes only at a clean break between boxes.
A jam maker selling at markets and two delis
Very small, one hob, one maker. A simple date code and a binder with ingredient receipts is enough, plus a note of which market day or deli took which jars, and the owner treats the weekly stock take as the drill. The aim is a system that people really follow.
Where lot systems quietly break
A system that fails does so in recognisable ways. The code goes on the label but not on the delivery note, so customers cannot quote it. Staff skip the record when it is busy and fill it in from memory on Friday. A leftover from one batch is poured into the next without a note, so a lot contains something its record does not show. Reworked product, where product is returned to a vat, becomes a quiet source of mixed lots, and the fix is to record rework as an ingredient with the lot it came from.
The one that bites hardest is shared lot codes across changes. Picture a producer that keeps the same code when a batch is topped up with a fresh ingredient delivery halfway through: later it cannot say which bottles had the new delivery. Treat any mid-batch change as a new lot, or record a split point with bottle counts. The simplest check is a monthly sample of five lots: for each, can you list ingredients and customers within 10 minutes? If not, the records, not the staff, need fixing.
Supplier changes can break your link silently, for example a supplier who changes its lot format or packaging size without telling you. The tutorial on spotting supplier specification changes covers watching for that. And if a retailer asks how you manage traceability, answer from these records: a completed drill with its times is stronger evidence than any description of the system.
If you would like help designing codes and records around your own equipment and label printer, that is what my AI implementation consultation covers; you can reach me through the contact page.
Questions small producers ask about lot codes
Is a best-before date enough as a lot code?
Usually not. A date shows when a product should be eaten, not which production run made it, and several runs can share one date. A lot code points to one run so you can find its ingredients and customers. Many producers print both: the date for the shopper, the lot for traceability.
How long should a lot code be?
Short enough to print clearly and type without mistakes, and long enough to be unique. Eight to twelve characters covers most small producers. If you plan to put the code in a barcode that follows GS1 rules, its batch or lot field allows up to 20 alphanumeric characters.
Do I need a different code for every ingredient delivery?
Yes, give each delivery of an ingredient an internal receipt number, and record the supplier's own lot code beside it. Then your batch record can name exactly which receipts went into each batch. Without this link you can trace forwards from your product but not back to the supplier.
Can AI decide what my legal traceability duties are?
No. It can help you design codes, draft records and run a mock recall. What the law requires of your products and markets is for your regulator's guidance, your food safety adviser or your auditor to confirm. Check the current rules for each market you sell into.
Further reads
- AI for a Soap Maker: Batch Records, Ingredient Labels and Listings — Batch records and labels for a maker of non-food products.
- AI for a Cottage Food Business: Labels, Pricing and Order Forms — Labels and pricing for a very small home-scale producer.
- BRCGS Audit Preparation for a Small Food Factory: AI Checklists — Prepare the records an auditor will ask to see.
- Foreign Body Complaint: Investigate and Reply as a Food Producer — Investigate a complaint using the lot on the pack.
- Cold Chain Temperature Logs: AI Flags Breaches in Logger Exports — Keep temperature logs that tie to the same lots.
- AI for Food Manufacturing: Six Jobs From Food Safety to Sales — Other jobs a food manufacturer can give to AI.
- Retailer Supplier Questionnaire: Answer It From Evidence, Using AI — Answer a retailer's traceability questions from your records.
- Starting a Chocolate Business: Costing, Labels and Where to Sell With AI — Per-bar costing, allergen label checks and a margin comparison of farmers market, online and wholesale, with illustrative numbers.
- AI Food Label Makers vs Manual Checks for Nutrition and Allergens — Can an AI food label maker replace manual verification? Compare automated recipe calculation against manual checks for nutrition facts and allergens.
- AI Tools and AI Development: The Complete 2026 Guide — the AI hub, including every tutorial in the AI-for-business series.
Sources: GS1 Application Identifier reference data (AI 10 batch or lot, up to 20 characters; AI 11, 15 and 17 dates as YYMMDD) and Regulation (EC) No 178/2002 Article 18 on EUR-Lex, checked November 2026.