The symbologies and what each is for
Barcode formats are not interchangeable, and picking the wrong one produces a code that scanners reject. EAN-13 and UPC-A are retail product codes, fixed at 13 and 12 digits respectively, with the final digit a check digit computed from the others. They are not free-form: the leading digits identify a country prefix and a manufacturer registered with GS1, so inventing a valid-looking EAN for your own use conflicts with someone's real allocation.
Code 128 is the workhorse for internal and logistics use. It encodes the full ASCII set, has no fixed length, and is dense — which makes it the right choice for anything not going through retail checkout. Code 39 is older, less dense, and limited to uppercase letters, digits and a few symbols, but it remains common in defence and automotive supply chains for compatibility reasons.
ITF-14 encodes shipping-carton quantities and is printed on corrugated packaging, where its thick bars survive poor print quality. If you need to encode more than a short identifier, a two-dimensional format such as a QR code or Data Matrix holds vastly more in less space.
Printing a barcode that scans
Most scanning failures are print problems rather than data problems. The quiet zone — the blank margin either side of the symbol — is essential, and the specification calls for at least ten times the narrow bar width. Codes fail constantly because a designer placed text or a border hard against the edge.
Contrast matters more than colour. Laser scanners read red light, so a red barcode on white is effectively invisible to them, while any dark colour on a light background works. Never invert to light bars on a dark ground, and avoid printing on reflective or transparent material without testing.
Size cannot be reduced arbitrarily. Each symbology defines a nominal magnification range, and printing below it produces bars too narrow for the scanner's resolution. Scaling must also be proportional — stretching a barcode horizontally alters the bar-to-space ratios the decoder depends on. Print at the intended size, on the intended material, and test with the actual scanner rather than a phone app, which is more tolerant than fixed industrial hardware.
Check digits and using codes commercially
The final digit of an EAN or UPC is a checksum computed by weighting the other digits alternately by one and three, summing, and taking the amount needed to reach the next multiple of ten. It catches single-digit errors and most transpositions, so a mistyped code is rejected rather than silently accepted as a different product.
This is why you cannot simply pick a number. A generator will compute the check digit, but that only makes the code structurally valid — it does not make it yours. Retail barcodes require a GS1 company prefix, obtained by registration with an annual fee, and using an unallocated or someone else's prefix means your product may collide with theirs in retailer systems.
Resellers offering cheap one-off barcodes exist, generally selling numbers from prefixes issued before GS1 tightened its rules. Some large retailers reject them, so check before buying if retail distribution is the goal. For internal use — asset tags, library systems, warehouse locations, event tickets — none of this applies: use Code 128 with whatever numbering scheme suits you.