Code 39 barcode generator
The oldest alphanumeric barcode still in daily use. Wider than Code 128 for the same data, but demanded by name in defence, automotive and a lot of older badge systems.
Generate a Code 39 barcode
SVG shape mask (decorative)
Upload an SVG — the barcode is clipped to its shape. A horse SVG makes a horse-shaped barcode.
Code 39 — also written Code 3 of 9 — encodes 43 characters: the digits 0–9, the capital letters A–Z, a space, and the symbols minus, full stop, dollar, slash, plus and percent. Every symbol is wrapped in an asterisk start and stop character, which is why you sometimes see a stray * at each end of the printed text.
Each character is nine elements wide, three of them wide and six narrow, and characters are separated by a gap. That fixed structure makes Code 39 self-checking — a single misprinted bar produces an invalid character rather than a wrong one — but it also makes it about 30 to 40 percent wider than Code 128 carrying the same string. If nothing forces your hand, Code 128 is the better default.
Something does often force your hand, though. Code 39 is written into the US Department of Defense LOGMARS specification, into AIAG labelling in the automotive supply chain, and into a great many access-control and library systems installed decades ago and never replaced. When a specification names Code 39, use Code 39.
What Code 39 encodes
| Character set | 0–9, A–Z, space, and - . $ / + % |
|---|---|
| Length | Variable |
| Check digit | Optional modulo 43; the symbology is self-checking without one |
| Dimensions | Linear (1D) |
| Quiet zone | 10 × the narrow-bar width on each side |
| Standard | ISO/IEC 16388 |
Where Code 39 is actually used
Defence and government
LOGMARS marking on US military supplies has specified Code 39 since 1981.
Automotive supply chain
AIAG and Odette shipping labels still call for Code 39 on many part and container tags.
ID badges and access control
Building access cards and staff badges, often on equipment that predates Code 128 support.
Libraries and archives
Accession numbers on spine labels, where the installed scanner base changes very slowly.
Rules this Code 39 generator enforces
- Lowercase letters are not part of Code 39. Type them and the generator will reject the value — send uppercase.
- Only the seven listed punctuation characters are legal. Underscore, comma, colon, hash and ampersand are not.
- The asterisk is the start and stop character. Do not type it yourself; the encoder adds it.
- Extended Code 39 can carry full ASCII by encoding each character as a two-character pair, but the scanner must be configured for it and most are not. Do not rely on it unless you have tested the exact reader.
Printing a Code 39 symbol that scans
Code 39 needs a clean wide-to-narrow ratio, normally between 2:1 and 3:1. Low-resolution printing squeezes that ratio and is the usual cause of intermittent reads, so print at the highest density your printer supports and export SVG for anything going to a plate.
Because Code 39 is so wide, the temptation is to shrink it until it fits. Resist that: reducing the narrow bar below about 0.19 mm puts it under the resolving power of most handheld laser scanners. Shorten the data or switch symbology instead.
Code 39 questions
Why does my Code 39 barcode show asterisks?
The asterisk is the mandatory start and stop character. Many renderers print it in the human-readable line. It is not part of the data your scanner returns.
Can Code 39 encode lowercase letters?
Not in the standard character set. Extended Code 39 maps lowercase onto pairs of standard characters, but the reader has to be explicitly configured to decode it, so plain uppercase is far safer.
Should I add the modulo 43 check digit?
Only if the specification you are working to asks for it. Code 39 is self-checking, and a check digit the receiving system does not expect will show up as an extra character on the end of every scan.