Skip to content
Developer Tools

Which Barcode Type Should You Actually Use? CODE 128 vs EAN-13 vs UPC-A

August 29, 2026 Admin 2 min read

Barcodes aren't one universal format — the five common types each follow different rules, and picking the wrong one for the job is the most common reason a printed barcode doesn't scan.

The five types, and what each is actually for

  • CODE 128 — encodes any text (letters, numbers, symbols), no fixed length. The right default for internal use: asset tags, warehouse tracking, internal SKUs, ticket numbers — anything that isn't a retail product hitting a standard store scanner.
  • CODE 39 — an older format, uppercase letters and numbers only. Still common in logistics and some legacy inventory systems, but more limited than CODE 128 for new projects.
  • EAN-13 — exactly 13 digits. The standard retail barcode used across most of the world outside North America — this is what's actually printed on products on store shelves internationally.
  • EAN-8 — exactly 8 digits. A shortened EAN variant for very small packaging where a full EAN-13 doesn't physically fit.
  • UPC-A — exactly 12 digits. The standard retail barcode in the United States and Canada.

Why the digit counts are strict, not a suggestion

EAN-13, EAN-8, and UPC-A require an exact digit count — 13, 8, and 12 respectively — because these formats end with a checksum digit calculated from the ones before it, and retail scanners verify that checksum before accepting a scan. A code with the wrong digit count isn't just unusual, it's structurally invalid for that format and won't scan at all, which is why our Barcode Generator checks the digit count upfront and tells you immediately, rather than generating an image that looks fine but fails at the register.

Picking the right one for your actual use case

If the barcode needs to work with a real retail point-of-sale scanner and you're selling a physical product, you need EAN-13, EAN-8, or UPC-A — and you'll typically be assigned that number by a barcode registration authority (GS1), not choose it arbitrarily. If it's for internal tracking, an event ticket, or anything not going through third-party retail infrastructure, CODE 128 is usually the simplest correct choice, since it can encode arbitrary text without a fixed digit count.

Using the tool

Choose a barcode type, enter the text or digits it requires, and download the result as a PNG — with adjustable width and height, and an option to show or hide the human-readable text under the bars. Try it here: Barcode Generator.

Developer Tools

Base64 Encoding: What It's Actually For (and the One Thing People Get Wrong)

Base64 output looks scrambled, which is exactly why people mistake it for security. It isn't — it's encoding, not encryption, and the difference matters.

Aug 26, 2026 Read More
Developer Tools

What a UUID Actually Is (and Why Two Are Never Going to Collide)

A UUID looks like random noise, but the format is precise, and the odds of ever generating a duplicate are so small the math is almost more interesting than the ID itself.

Aug 8, 2026 Read More
Developer Tools

What "Password Entropy" Actually Means (and Why Length Beats Complexity)

The bits-of-entropy number next to a generated password isn't marketing fluff — it's a real, calculable measure of how many guesses an attacker would need. Here's the actual math.

Aug 6, 2026 Read More