Which barcode format should I use: Code 128, EAN-13, or Code 39?
Use EAN-13 for retail products sold in stores, since scanners worldwide recognize its 13-digit format. Use Code 128 for shipping labels and inventory, where you need compact encoding of letters, numbers, and symbols. Use Code 39 for simple internal labeling, such as asset tags, where compatibility matters more than density.
Choosing the right barcode format is most useful when you understand both the input and the meaning of the output. Each format has strict rules about which characters it encodes and how scanners read it.
What these barcode formats do
Linear 1D barcodes encode text into parallel bars that scanners read. The three most common formats:
- Code 128: full ASCII, very compact — logistics and shipping
- EAN-13: 13 digits with a check digit — retail products worldwide
- Code 39: letters, digits, and a few symbols — simple, widely supported
What to enter
Use complete and accurate input. To generate a barcode you need:
- The data to encode (digits for EAN-13, text for Code 128 or Code 39)
- The format that matches your scanner and use case
- For EAN-13: exactly 12 or 13 digits (the check digit can be calculated)
- A quiet zone: blank space around the barcode
Worked example: before and after
Before — printing shipping labels with the wrong format: A warehouse prints EAN-13 labels for internal bins. EAN-13 only holds digits, so bin names like "A-42" fail, and the barcodes scan but mean nothing to the system.
After — choosing Code 128: Switching to Code 128 lets the label encode "A-42" compactly in a short barcode. Scanners read it instantly, and the same format works for tracking numbers with letters and symbols.
How to read the result
A result should be treated as a decision aid. Look for three things:
- The human-readable text: the encoded data printed below the bars
- The check digit: guards against misreads
- Print quality: crisp edges, correct size, adequate quiet zone
Format comparison: Code 128 vs EAN-13 vs Code 39
- Code 128: ASCII 0-127, high density, variable length, built-in check digit — best for shipping and inventory
- EAN-13: 12-13 digits only, fixed length, mandatory check digit — retail products
- Code 39: A-Z, 0-9, and - . $ / + % * — low density, easy to print — asset tags and badges
- Checksum: built into Code 128 and EAN-13; optional in Code 39
- Scanner support: nearly universal for all three
Common mistakes when using barcode formats
- Using EAN-13 for text data (it only encodes digits)
- Making the barcode too small to scan reliably
- Printing without a quiet zone
- Low-contrast printing (gray on white fails)
- Guessing the check digit instead of calculating it
- Using Code 39 where density matters (labels get huge)
Practical tips for better results
Match the format to the scanner at the receiving end:
- Test-scan every label before printing in bulk
- Keep barcodes at least 1 inch wide for handheld scanners
- Use vector output (SVG or EPS) for crisp printing
- Store the encoded data in your system alongside the image
- Follow your carrier's label specification exactly
When these formats are not enough
1D barcodes hold limited data — a few dozen characters at most. For URLs, product details, or multilingual text, use QR codes instead. For tiny items like circuit boards, consider Data Matrix.
Frequently asked questions
Can I use EAN-13 for my own products?
EAN-13 numbers are assigned by GS1. For internal use you can generate any 13-digit code, but retail sale requires a registered GS1 prefix.
Which format do shipping carriers use?
Most use Code 128 for tracking numbers because it encodes letters and numbers compactly. Always follow your carrier's label specification.
Why won't my barcode scan?
Check size, contrast, quiet zone, and damage. Also confirm the scanner supports the format — some older scanners only read Code 39.
Do barcodes need a check digit?
Code 128 and EAN-13 include one automatically. Code 39's is optional. The check digit catches misreads, so keep it.
Can I print barcodes on a regular printer?
Yes — laser printers work well. Avoid inkjet smudging, and always test-scan the first print.