Code 128 vs Code 39: Which Barcode Should You Use?
Code 128 vs Code 39 compared: character sets, check digits, how much space each takes, scanner support, and which one to pick for labels, assets and badges.
By StylQR Editorial TeamPublished 5 min read

Table of contents
For most new labels, Code 128 is the better choice. It encodes all 128 ASCII characters, always includes a check character, and takes up far less width for the same data. Code 39 is worth using when a customer, industry standard or older system specifically asks for it, because it's simpler and almost every scanner reads it by default.
Here's how they differ in detail, with real width comparisons and the check calculations for each.
At a glance
| Code 39 | Code 128 | |
|---|---|---|
| Standard | ISO/IEC 16388 | ISO/IEC 15417 |
| Introduced | 1974, Intermec | 1981, Computer Identics |
| Characters | 43: A to Z, 0 to 9, space and - . $ / + % | All 128 ASCII characters |
| Lowercase | Only via Full ASCII pairs | Yes, natively |
| Check character | Optional (mod 43) | Mandatory (mod 103) |
| Width per character | 13 to 16 modules, including the gap | 11 modules; digits in pairs |
| Start and stop | * at each end | Start A, B or C, plus a 13-module stop |
| Typical use | Automotive, defence, ID badges, older systems | Shipping, warehousing, asset tags, healthcare |
How Code 39 works
Each Code 39 character is nine elements, five bars and four spaces, and exactly three of the nine are wide. That's where the full name "Code 3 of 9" comes from. Characters are separated by a narrow gap, and the whole symbol starts and ends with an asterisk, so PART-42 is encoded as *PART-42*.
Because every character carries its own fixed pattern of wide and narrow elements, Code 39 is self-checking: a single printing defect rarely turns one valid character into another. That's why the check character is optional.
When you do want one, it's a simple mod 43 sum. Each character has a value (0 to 9 are 0 to 9, A to Z are 10 to 35, then - is 36, . 37, space 38, $ 39, / 40, + 41, % 42). For ABC: 10 + 11 + 12 = 33, and 33 divided by 43 leaves 33, which is the letter X. The encoded data becomes ABCX. The scanner must be told to expect it.
Full ASCII Code 39
To get lowercase and extra symbols, Full ASCII mode writes them as two-character pairs using $, %, / and +. It works, but it doubles the width of those characters, and a scanner not set to Full ASCII will output the raw pairs.
How Code 128 works
Each Code 128 character is 11 modules wide, made of three bars and three spaces. There are three code sets:
- Code set A: uppercase, digits, punctuation and control characters (like tab and carriage return).
- Code set B: uppercase, lowercase, digits and punctuation. The usual choice for text.
- Code set C: pairs of digits from 00 to 99, so each 11-module character carries two digits.
A barcode can switch sets mid-way. Good generators pick the shortest combination automatically, using set C for runs of digits.
The check character is mandatory. It's a weighted sum: the start code's value, plus each data character's value multiplied by its position, all divided by 103, keeping the remainder. For 123456 in set C, the values are 12, 34 and 56 with start C worth 105:
- 105 + (12 × 1) + (34 × 2) + (56 × 3) = 105 + 12 + 68 + 168 = 353.
- 353 divided by 103 is 3 remainder 44.
- The check character is the one with value 44.
The scanner checks this and won't output a misread, which is a big part of why Code 128 has a reputation for reliability.
The width difference in practice
Width is where Code 128 wins clearly. Counting modules (X), assuming a 3:1 wide-to-narrow ratio for Code 39:
| Data | Code 39 width | Code 128 width |
|---|---|---|
ABC123 | 127X | 101X (set B) |
123456 | 127X | 68X (set C) |
00012345678 (11 digits) | 207X | 112X (mostly set C) |
Those figures exclude quiet zones. At an X-dimension of 0.33 mm, the 11-digit example is about 68 mm wide in Code 39 and about 37 mm in Code 128. On a small label, that decides whether the code fits at a scannable size at all.
Which one should you pick?
Pick Code 128 when:
- You're designing a new labeling scheme and nobody has mandated a format.
- Data includes lowercase letters or is mostly numeric.
- Space is tight, or the data is longer than about 10 characters.
- You'll later need GS1-128 for shipping labels; your scanners and printers will already support it.
Pick Code 39 when:
- A customer, auditor or standard requires it. Some automotive and defence labeling specifications are built on Code 39.
- You're matching existing labels in a system that expects it.
- You want people to be able to type the content using a basic barcode font, with only uppercase and digits.
Printing tips for both
- Keep a quiet zone of at least 10 modules on each side. It's the most common cause of no-reads on homemade labels.
- Print at a resolution that matches the module width. On a 203 dpi thermal printer, one dot is about 0.125 mm, so choose an X-dimension that's a whole number of dots.
- Dark bars on a light background. Red bars are invisible to red-light scanners.
- Test with the scanner you'll actually use, from the distance it will be used at.
Making either barcode
The Code 128 generator includes the mandatory mod 103 check character for you. The Code 39 generator checks your text against the allowed characters as you type. Both let you set bar width and height in millimeters and download SVG, PNG at up to 1200 DPI, or an exact-size PDF. For a complete walk-through, see how to generate barcodes online for free, and if you're labeling a lot of items, how to generate multiple barcodes at once covers bulk output. If you'd rather store more data in less space, 1D vs 2D barcodes explains when a Data Matrix makes more sense.
Frequently asked questions
Can a Code 39 barcode contain lowercase letters?
Only in Full ASCII mode, where each lowercase letter is written as a pair such as +A for a. The scanner must have Full ASCII mode turned on, otherwise it shows the pairs literally.
Is Code 128 the same as GS1-128?
GS1-128 is Code 128 with an FNC1 character after the start code and data structured with GS1 Application Identifiers. Every GS1-128 is a valid Code 128, but not the other way round.
Why does my Code 39 scan show asterisks?
Some fonts and generators expect you to type the asterisks yourself, and some scanners are set to transmit the start and stop characters. Remove them from the data or change the scanner setting.
Can I use Code 128 on retail products instead of a UPC?
No. Checkouts expect an EAN-13 or UPC-A carrying a GS1 GTIN. Code 128 is for internal and logistics labels.


