Test barcode numbers
Numbers and symbols for testing a scanner, a point of sale, or a warehouse system. Correct ones for the happy path, and deliberately wrong ones for everything else, because a barcode test suite made only of valid codes tests almost nothing.
A valid code is half a test
If your fixtures are all correct, every test asserts the same thing: that the reader reads. What it cannot tell you is what happens when the check digit is wrong, when the symbology is not the one your parser expects, when the string is longer than the database column, or when a warehouse operator scans a carton code into a field built for an item code.
Those are the cases that break systems in production, and each of them needs a fixture that is wrong in one specific, known way. This generator will make them, because it tells you what is wrong rather than silently correcting it.
Fixtures worth having
- A valid EAN-13, as the control. Without a baseline you cannot tell a strict reader from a broken one.
- The same EAN-13 with the check digit off by one. A reader that accepts it has a defect; a system that stores it has a worse one.
- A UPC-A and the EAN-13 of the same product, which are the same bars, to see whether your code treats them as one product or two.
- An ITF-14 carton code, to check that a field expecting thirteen digits rejects fourteen rather than truncating.
- A Code 39 payload with a space and one with lowercase letters, which come back uppercased, to find case-sensitive comparisons downstream.
- A GS1-128 with three Application Identifiers, to see whether your parser handles the variable-length field separator.
- The longest string your chosen symbology allows, and one character more, which should be refused.
- A Pharmacode, which has no check digit at all, if anything in your system assumes every barcode is self-validating.
What a correct system does with a bad code
Reject it and say which check failed. That sounds obvious and it is the behavior least often implemented: the common failures are accepting a bad check digit, and rejecting a good code with a message that names no reason. Both cost hours in a warehouse.
Worth testing separately: the difference between a code that cannot be read and a code that reads to invalid data. They arrive at your software through different paths and deserve different messages, and a system that reports both as an unreadable barcode sends somebody to clean a scanner lens that is fine.
Where these fixtures come from
Every symbology here is encoded from its own specification, and nineteen of the twenty-two are verified against zxing-cpp, an independent decoder, before release. So a code labeled valid on this site has been read back correctly by something that is not our own code, and a code you were told is invalid is invalid for the stated reason.
For QR specifically there is more: a testing toolkit that produces damaged symbols and degraded images with the expected outcome recorded for each one, including the cases that sit either side of what error correction can repair.
Questions
Can I get a barcode with an intentionally wrong check digit?
Yes. Type the full number with the digit you want and you are told what the correct value would be rather than being blocked. That is the fixture you need to prove your validation runs.
Are these real product numbers?
No, and they should not be. Retail numbers are issued by GS1 to a specific company, so invented numbers are correct for testing and wrong for a product that will cross a checkout. The arithmetic and the geometry are real either way, so a scanner behaves exactly as it would with a genuine code.
How do I generate a few hundred at once?
The bulk pages run the same encoders over a list, so the codes are identical to what the single generator produces. Sequential numbers with correct check digits are the usual starting point for a load or throughput test.
What about testing a scanner rather than my software?
Print at the size and on the material you will use in production, because that is where read rates actually differ. Take the SVG rather than scaling a PNG, and include a code at the smallest size you intend to deploy.
More barcode generators
Free barcode generator · EAN-13 barcode generator · UPC barcode generator · Code 128 barcode generator · Code 39 barcode generator · GS1-128 barcode generator · Barcode generator · QR code generator