Published: 2026-11-16
Code 128 and Code 39 are the two general-purpose barcodes used for things that are not sold at a shop till: asset tags, bin locations, part numbers, work orders, ID badges. Neither needs a registered number. You can put any value you like in either one.
For a new system, Code 128 is the better default. Code 39 is the right choice in two cases: something you already own expects it, or you need to make labels with nothing more than a barcode font.
At a glance
| Standard | Code 128: ISO/IEC 15417 (2007). Code 39: ISO/IEC 16388 (2007) — ISO/IEC 15417 |
|---|---|
| Characters | Code 128: all 128 ASCII characters. Code 39: 43 characters (A to Z, 0 to 9, space and - . $ / + %) — ISO/IEC 16388 |
| Check character | Code 128: always present, modulo 103. Code 39: optional, modulo 43 |
| Width per character | Code 128: 11 modules, or 5.5 per digit when digits are paired. Code 39: 16 modules at a 3:1 wide-to-narrow ratio |
| Fixed overhead | Code 128: 35 modules (start, check and stop). Code 39: 32 modules (the two asterisks) |
| Measured: PART-10482 | Code 128: 134 modules. Code 39: 191 modules |
| Measured: 1234567890 | Code 128: 90 modules. Code 39: 191 modules |
| Introduced | Code 128: 1981, Computer Identics. Code 39: 1974, Intermec |
What each one can encode
Code 39 has 43 characters: the capital letters A to Z, the digits 0 to 9, space, and the symbols - . $ / + %. The asterisk is reserved as the start and stop mark. There is no lowercase, no underscore, no @ and no comma. If your part numbers contain any of those, plain Code 39 cannot hold them.
An extended mode, often called Full ASCII Code 39, gets round this by writing each missing character as a pair of ordinary ones. It doubles the width of every such character, and the scanner has to be switched into the same mode or it will read the pairs literally. The Code 39 generator on this site makes standard Code 39 only.
Code 128 encodes all 128 ASCII characters directly. It does this with three character tables, called code sets A, B and C. Set B covers upper and lower case text, set A covers capitals and control characters, and set C holds the digit pairs 00 to 99. The encoder picks and switches sets for you, so you never choose one by hand.
How much space each one takes
Barcode width is counted in modules, where one module is the width of the narrowest bar. Every Code 128 character is 11 modules wide. A Code 39 character is 9 bars and spaces, 3 of them wide, plus a gap before the next character. With wide bars three times the narrow ones, that comes to 16 modules.
We rendered two values in both formats with the library this site uses and counted the modules. PART-10482 came out at 134 modules in Code 128 and 191 in Code 39. With a 0.25 mm narrow bar, that is 33.5 mm against 47.8 mm, before the blank margins.
The gap grows when the value is mostly digits. In code set C, one Code 128 character carries two digits, so each digit costs 5.5 modules. The value 1234567890 is 90 modules in Code 128 and 191 in Code 39: 22.5 mm against 47.8 mm at the same bar width.
This matters most on small labels. If a Code 39 symbol does not fit, the usual fix is to shrink the bars, and thin bars are the most common reason a printed barcode fails to scan. Code 128 lets you keep wider bars in the same space.
Error checking
Every Code 128 symbol ends with a check character calculated from all the others, modulo 103. The scanner recomputes it and rejects the read if it does not match. You do not type it and it is not part of your data.
Code 39 is self-checking: each character must have exactly three wide elements out of nine, so a single damaged bar produces an invalid pattern, not a different valid character. A modulo 43 check character exists but is optional. If you add one, the scanner has to be set to expect it, otherwise it will pass the check character through as an extra letter at the end of your data.
In practice both read reliably when printed well. On worn labels, or labels printed with too little contrast, the mandatory check in Code 128 is the stronger guard against a wrong read being accepted.
When Code 39 is still the right choice
Something you already use requires it. Code 39 has been in service since 1974, and the US Department of Defense adopted it for its LOGMARS programme in the early 1980s. Plenty of customer labelling specifications, older warehouse software and fixed scanners were set up around it and never changed. If a specification names Code 39, print Code 39.
You are printing from a barcode font. Because Code 39 has no required check character and every character has one fixed pattern, you can type an asterisk, your value and another asterisk, apply a Code 39 font, and get a valid barcode. A Code 128 font does not work that way: the check character and the code set switches have to be calculated first, so typing the value and changing the font produces a barcode that will not scan.
Your values are short, uppercase and the label has room. In that case the density advantage of Code 128 gains you nothing, and either format is fine.
Code 128 is not the same as GS1-128
GS1-128 is Code 128 with a special function character (FNC1) at the start and data laid out using GS1 application identifiers, such as (00) for a pallet serial number or (10) for a batch. Shipping labels for retailers and carriers that follow GS1 rules need GS1-128.
A plain Code 128 barcode with the same digits in it is not a GS1-128 barcode, and a receiving system that expects one will not accept the other. Code 39 is not an option there at all. If you are labelling pallets or cartons for a trading partner, use the GS1-128 or SSCC-18 format in the barcode generator.
Switching from Code 39 to Code 128
The data does not change. A scanner sends your software the same characters whichever barcode they came from, and by default it does not send the Code 39 asterisks. A database of part numbers needs no changes.
Check the scanners first. Nearly all current handheld scanners read both formats, but either can be turned off in the scanner's settings, and fixed industrial readers are often configured for one format only. Scan a test label of each kind before you reprint anything.
You can run both at once. Old Code 39 labels keep working alongside new Code 128 ones for as long as both formats stay enabled, so there is no need to relabel existing stock on day one.
Printing either one
Leave a blank margin of at least ten times the narrow bar width on the left and the right. Without it the scanner cannot tell where the barcode starts.
Print dark bars on a light background and resize the image in proportion. Stretching a barcode sideways to fill a label changes the bar widths unevenly once it is printed, which is a common cause of failed scans. If you need a narrower barcode, pick the denser format or shorten the value.
Test the printed label with the scanner that will be used in practice, not only with a phone. Phone cameras are more forgiving than the laser and linear scanners found in warehouses.
Frequently asked questions
- Can a scanner that reads Code 39 also read Code 128?
- Almost always. Current handheld scanners support both, though either format can be switched off in the scanner's settings. Older fixed readers may be set up for one format only, so scan a test label before you commit to a change.
- Can Code 39 encode lowercase letters?
- Not in its standard form. Full ASCII Code 39 writes each lowercase letter as two characters, which doubles its width, and the scanner must be set to the same mode. If you need lowercase, Code 128 handles it directly.
- Which is better for inventory and asset labels?
- Code 128, unless your existing system requires Code 39. It fits more data on a small label, accepts any character you are likely to use in a part number, and always includes a check character.
- Do I need to register or buy numbers for Code 128 or Code 39?
- No. Both can hold any value you choose and neither involves GS1. Registered numbers are only needed for retail barcodes such as EAN-13 and UPC-A, and for GS1-128 shipping labels.
- What about Code 93?
- Code 93 was designed as a denser replacement for Code 39 with the same basic character set. It is far less widely used than Code 128, so choose it only if a system you work with asks for it.
Related tools
- Code 128 barcode generator — All ASCII characters, check character added for you.
- Code 39 barcode generator — Uppercase letters, digits and seven symbols.
- Bulk barcode generator — Up to 500 barcodes in one ZIP from a list or spreadsheet.
