Back to All Blog Posts
Barcode Guides

Code 128 vs Code 39: Differences and Which Barcode to Use

By 4 min read
A Code 39 barcode and a shorter Code 128 barcode with the same data
Short answer

Use Code 128 for most new labels: it encodes all 128 ASCII characters, has a built-in check character and is much more compact, especially for long numbers. Use Code 39 when a customer, industry standard or older system requires it (defence, automotive and healthcare labels often do), or for very simple capital-letter IDs. For retail products use EAN or UPC instead; for logistics data use GS1-128.

Code 39 and Code 128 are the two workhorse barcodes for anything that isn’t a retail product: asset tags, inventory labels, file folders, ID badges, work orders and parcel references. Choosing between them is mostly about space, characters and who will be scanning.

Side by side

Code 39Code 128
Introduced19741981
Characters43: A–Z, 0–9, space and - . $ / + % (Full ASCII mode adds the rest)All 128 ASCII characters, upper and lower case
Check characterOptional (mod 43)Built in and mandatory (mod 103)
Width for the same dataWideCompact; long numbers are about half the width
Start/stopAn asterisk (*) at each endStart code A, B or C plus a stop pattern
Typical usersUS defence (LOGMARS), automotive (AIAG), healthcare (HIBC), older systemsShipping, warehousing, labs, general inventory, GS1-128

Why Code 128 is so much shorter

Code 128 has three character sets. Set C packs two digits into each symbol character, so a 12-digit number takes six characters instead of twelve. Generators switch sets automatically. Code 39 spends a fixed, fairly wide pattern on every single character, plus the gap between characters. For a 10-character mixed ID the difference is noticeable; for a 20-digit number it’s dramatic.

When Code 39 still makes sense

  • A standard or customer requires it. Defence suppliers, some automotive and healthcare labels specify Code 39. Follow the spec.
  • Very old scanners or software that were set up only for Code 39.
  • Short, capital-letter IDs where space isn’t tight, like "BIN-A12".
  • Easy to print by hand-made fonts. Each character stands alone, so a simple barcode font in Word can produce it, though a generator is more reliable.

When to choose Code 128

  • New labelling projects with no legacy constraint.
  • Long numbers (serials, order numbers, tracking references).
  • Lower-case letters or punctuation in the data.
  • Small labels where width is limited.
  • Anywhere misreads would be costly; the mandatory check character catches most errors.

And Code 93, GS1-128, EAN?

NeedUse
Retail product sold in shopsEAN-13 or UPC-A with a GS1 number
Batch, expiry, weight or SSCC on cartons and palletsGS1-128 (Code 128 with application identifiers)
Something like Code 39 but more compactCode 93
Lots of data, or very small itemsData Matrix or a QR code

A full overview is in barcode types explained, and shipping-specific codes in barcodes for shipping cartons.

Printing tips for both

  • Leave a quiet zone (blank space) of at least 10 times the narrowest bar on each side; Code 39 and Code 128 both fail without it.
  • Keep bars at least 10 to 15 mm tall for handheld scanners.
  • Download vector (SVG or PDF) for printing; never stretch a small PNG.
  • Test with the actual scanner your team uses, at the actual label size.

Frequently asked questions

What is the difference between Code 128 and Code 39?

Code 128 encodes all ASCII characters, has a mandatory check character and is much more compact. Code 39 encodes 43 characters, is wider and is required by some older standards.

Is Code 128 better than Code 39?

For most new labels, yes: it is shorter and more reliable. Use Code 39 when a standard, customer or older system requires it.

Can Code 39 include lower-case letters?

Only in Full ASCII mode, which uses two characters for each lower-case letter and makes the barcode longer.

Which barcode should I use for inventory?

Code 128 for most internal inventory and asset labels, unless your software specifies another type.

Can I use Code 128 on products sold in shops?

No. Retail products need EAN-13 or UPC-A barcodes with a GS1 number.

Create a Code 128 barcode

Automatic character sets and check digit. Download PNG, SVG or PDF.

Open Code 128 Generator
Akhtar Ali
Akhtar Ali

Founder of CleanPDF. I build the site’s browser-based PDF, image, QR code and calculator tools, and I write these guides around the questions people send in while using them.