A dye lot number is a unique identifying code which is printed on the label of a skein of yarn so that consumers can purchase skeins from the same lot, to ensure consistent coloring. Typically the dye lot number is readily identifiable on the label, often because it is labeled “dye lot #” or “lot #.” All high-quality yarn comes with a dye lot number, and many cheaper yarns also include dye lot information, except for those which are dyed before being spun.
The reason the dye lot number is included is that color can vary in very subtle ways from batch to batch. By purchasing skeins of yarn which have been processed together, knitters can ensure that these subtle variations will not ruin a piece. This is why most knitting patterns include an estimate of the number of skeins they will require, allowing knitters to buy all their yarn at once, and many knitters purchase a few extra balls just to be sure.
Dyeing yarn is a very delicate and fussy business, even in large commercial productions. Many things can influence the tint of a dye, and not all of these things are controllable. Despite having precise dye recipes for various colors in a company's catalog, the colors may vary slightly from lot to lot. At times, this is not a major problem, but sometimes there is a problem, and often the issue does not become apparent until a piece has been fully knitted and yarn from a different lot sticks out like a sore thumb.
Many knitting stores have signs up to remind knitters that they should check the dye lot number on the yarns they purchase, and some attentive staff will check dye lot numbers as they ring up purchases, to make sure that the yarn will be consistent. Because the dye lot issue is well understood, most knitting stores also have very flexible return policies, allowing knitters to buy extra skeins or balls of yarn and return the ones which are not used.
In the event that one knitting store does not have enough yarn from the same lot for a project, knitters can call other knitting stores with the dye lot number to see if they have additional skeins. Many Internet yarn retailers also allow knitters to check by dye lot number when they order yarn, and these retailers are careful to pull orders from yarn with matching dye lot numbers.
In the event that you end up with a mixed batch of yarn, you don't need to despair. You can use yarn from a different dye lot for the edges or trim of a piece, causing the color variation to look like a deliberate choice, rather than an accident.