Code 128 vs. Code 39

Code 128 vs Code 39

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.

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. The output resolution is 150dpi.

Encoding capital letters yields the smallest difference in size. Here is a Code 128 symbol encoding "ABCDEF":

Code 128 encoding capital letters

Code 39 with the same data. The symbol is about 30% wider but still manageable:

Code 39 encoding capital letters

This changes dramatically when we need to encode small caps. Code 128 with "abcdef" has the same size as the large cap barcode:

Code 128 encoding small cap letters

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:

Code 39 encoding small cap letters

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 128 encoding numeric data

Code 39, however, can not compress the encoded data. The barcode is considerably larger:

Code 39 encoding numeric data

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 39

It 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:
  • Make sure that the barcode symbology is actually activated in the barcode scanner. Consult your scanner's manual.
  • The print quality must be adequate. For Code 128 and Code 39, a resolution of 150-200dpi or higher is recommended (the sample codes above were created with 150dpi). Also, make sure that the code is not printed too small. The minimum module width (i.e. the width of the narrowest bar) should not be below 0.3 mm. The height should not be below 10 mm. A space (the so called "quiet zone") of at least five to ten millimeters should be left around the code.
  • By default, many scanners require a barcode to encode at least four characters. If so, a barcode with only three characters will not scan. Check your barcode scanner's manual.
  • With Code 128 almost all barcode readers on the market today will will expect a checksum with the barcode. If the code does not scan you may have created it without a checksum.

Generating Code 128 and Code 39

Softmatic BarcodePlus creates Code 128 A, B, C, GS1 and Code 39 / 39 Extended. The software analyzes the data to encode and will automatically create the smallest possible symbol. With both symbologies, the check digits are calculated automatically.

Barcode Generator for Code 128 and Code 39

The barcodes are exported as EPS (vector) and to common raster formats.

Windows - Softmatic® BarcodePlus (Windows 7 or higher): Download

Mac - Softmatic® BarcodePlus (macOS 10.7 or higher): Download

Code 128, Code 39 Bulk Generator

For batch creation of Code 128 and Code 39, use our Bulk Barcode Generator. Softmatic BarcodeFactory 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.

Bulk creating Code 128 symbols with serial, consecutive numbers: Video.

Bulk Batch Barcode Generator for Code 128 and Code 39

The barcodes are exported as EPS (vector) and to common raster formats.

Windows - Softmatic® BarcodeFactory (Windows 7 or higher): Download

Mac - Softmatic® BarcodeFactory (macOS 10.7 or higher): Download