How the decoder reads a label
Packaging mixes the date with everything else: lot numbers, plant codes, packing times, weights. The decoder looks at every number that could be a date, then scores each one the way FreshScan does on your phone:
- Words next to the date decide its type.
BEST BY,BBandBEST BEFOREmake a best-by date;USE BYa use-by date;SELL BYandDISPLAY UNTILa sell-by date;EXPan expiration date. A keyword on the line just above or below counts too. - Packed-on and manufacturing dates lose. A date next to
PACKED ON,PKD,MFGorPRODis scored down, so the expiry date wins. Numbers afterLOT,UPCorNET WTare ignored. - Plausible food dates score higher. A date between today and about two years out is typical. Dates far in the past or many years ahead are doubted.
- It never auto-picks when it could be wrong. Two different dates, or a numeric date that reads two ways, are shown as choices.
Formats it understands
| Printed | Read as | Notes |
|---|---|---|
OCT 04 2026 | October 4, 2026 | Month names and abbreviations, including SEPT and some European ones (OKT, DEZ, MAI) |
04OCT26 | October 4, 2026 | Day first, no spaces, two-digit year |
10/04/26 | October 4 or April 10 | Depends on the order you pick (MM/DD or DD/MM); both are shown if both are plausible |
2026-10-04 | October 4, 2026 | Year-first dates are never ambiguous |
10/2026 | October 31, 2026 | Month and year only: read as the end of the month |
OCT 04 | Next October 4 | No year printed: the next sensible year, flagged |
More on each format in how to read expiration dates, and on the 10/04 problem in month or day first?
What each kind of date means
Only infant formula is required by federal rules to carry a date. Everything else is dated voluntarily by the manufacturer, which is why the wording varies so much. USDA says best-by, sell-by and freeze-by dates are not safety dates. California's 2024 labeling law goes further and reserves “USE by” for dates about safety. The full comparison is in sell by vs use by vs best by.
What it can't do
It reads text you type; it can't see the package. Julian pack codes like the three-digit number on egg cartons aren't calendar dates, so they're left alone here: use the Julian date converter. And it can't tell you how long a food keeps once opened; for that, try the food expiration calculator.
Questions people ask
Is this the same logic the FreshScan app uses?
Yes. The decoder is a line-by-line port of the date parser inside FreshScan. It is tested against the app's own code on more than 4,000 label variations, and both must give the same date, date type, confidence and flags. The app adds the camera: it reads the text from the package with Apple's on-device text recognition, then runs the same rules.
Why does it ask me to choose between two dates?
Some labels print more than one date, such as a sell-by and a use-by date, or a date like 03/04/27 that means March 4 in the US and April 3 in most other countries. When both are plausible the decoder shows both and lets you pick, instead of guessing. The use-by or expiration date is listed first because it's usually the one to act on.
What if the label has no year?
Dates like SEP 17 are placed in the next sensible year: this year, unless that day is more than 45 days in the past, in which case next year. The result is marked 'Year not printed' so you can check it.
Does the decoder tell me whether food is safe to eat?
No. It reads the date the manufacturer printed and explains what that kind of date means. Whether food is still good also depends on how it was stored, whether it was opened, and how it looks and smells. See the shelf-life guides for storage times, and when in doubt, throw it out.
Is anything I type sent anywhere?
No. The decoder runs entirely in your browser; the text you type is not sent to a server or stored.
Sources
- Food Product Dating — USDA Food Safety and Inspection Service
- AB 660 (2024): Food labeling: quality dates and safety dates — California Legislative Information