Code 128 vs. Code 39 - What are the differences
Code 128 (top) and Code 39 (bottom) are two popular choices for encoding alpha-numeric data and letters in a barcode symbol. On this page we describe the differences between the two symbologies and look at the pros and cons of both barcode types.
Code 128 vs Code 39 at a glance:
Comparing the size of Code 128 and Code 39
We begin by looking at the size of individual symbols for different kinds of data. All barcodes below were created with a module height of 15mm and a module width of 0.5mm (a module is the thinnest bar). The output resolution is 150dpi.
Encoding capital letters yields the smallest difference in size. Here is a Code 128 symbol encoding "ABCDEF":
Code 39 with the same data. The symbol is about 30% wider but still manageable:
This changes dramatically when we need to encode small caps. Code 128 with "abcdef" has the same size as the large cap barcode:
Code 39, however, can't natively encode small caps; instead, the barcode generator has to switch to Code 39 Extended. Here, each letter is encoded with two symbols, resulting in a barcode that is almost twice as wide:
This not only takes up much more space on labels and packaging; it can also cause problems during scanning if the barcode is wider than the reading window of the scanner.
Code 128 features a numeric compaction mode. Here, a single symbol within a code encodes two digits. Code 128 with "12345678":
Code 39, however, can not compress the encoded data. The barcode is considerably larger:
Conclusion: Code 128 has much higher data density than Code 39 - it can encode more data in a smaller symbol.
Code 128 and Code 39 supported characters sets
Both codes support the full ASCII set of 128 characters including control characters like "TAB", "CARRIAGE RETURN", etc. Natively, Code 39 will only encode letters A-Z, digits 0-9 and a handful of special characters. As illustrated with the small caps above, the symbology requires the use of two symbols per character to encode the full ASCII set (table of Code 39 Extended characters).
Neither code can easily encode accented or diacritic characters ("Umlauts").
Unicode, non-latin, cyrillic, asian scripts with Code 128 and Code 39
Neither code symbology supports encoding Unicode characters or non-latin codepages like cyrillic. Likewise, emojis or similar content can not be encoded. Several 2D barcodes are Unicode capable, popular examples are Datamatrix and QR (cellphone barcode).
Code 128 and Code 39 check digit calculation
Both code symbologies employ a simple check digit calculation algorithm that involves summing up the individual symbols and then modulo divide the sum by some factor. Usually the barcode generator will handle this.
While Code 128 is almost always used with a check digit, Code 39 symbols can be created without one. Code 39 is therefore easy to use with a barcode font, for example in Excel: Enter data, add "*" for start and stop code and format the text with the font. This will yield a valid barcode symbol.
Scanning Code 128 and Code 39It is safe to assume that all current barcode readers will scan both code symbologies. The same goes for barcode reader apps. If a printed barcode can not be scanned, check this:
Create Code 128 and Code 39 in Illustrator, InDesign
Easy to use barcode plug-ins and extensions for Adobe InDesign, Illustrator und Photoshop. For more videos, see the Softmatic Youtube Channel
The Softmatic barcode plug-ins and extensions for InDesign, Illustrator and Photoshop are available on the Adobe Exchange.
Stand-alone software for Code 128 and Code 39Softmatic BarcodePlus V5 creates Code 128 and Code 39 and will export the barcode as PDF / SVG (resolution-independent vector) oder raster image (PNG, TIFF). The app will automatically select the appropriate 128 subtype; when using Code 39 the app switches to Code 39 Extended when necessary:
Code 39, Code 128 mass creation
For batch creation of Code 39 / 39 Extended and Code 128, use Softmatic BarcodeFactory V5. The software will create thousands of barcode symbols in seconds, with data coming from the built-in serial number generator, the clipboard or via import from Excel, Numbers or CSV text files: