Code 39 barcode generator

Code 39 is the symbology you choose when nobody has to agree to your numbering. There is no prefix to licence and no authority to register with, which is why it has outlived several generations of better formats in stock rooms, workshops and filing systems. Its alphabet is exactly 43 characters: the ten digits, the twenty-six capital letters, the space, and the six marks minus, full stop, dollar, slash, plus and percent. Every character is nine elements wide, three of them wide bars or spaces and six narrow, so a reader decides each element with one binary question. That is the source of its toughness and also of its cost, which is width.

Appearance
Size
Caption
Caption position
Caption alignment
Colours

442 × 237 px in the PNG

Size units

Specification

Character set
letters and digits
Length
from 1 to 43 characters
Check digit
not used by this symbology

Where it is used

  • Asset tags on equipment, where the number comes from your own fixed-asset register and means nothing to anyone outside the company
  • Workshop and laboratory labels read by fixed scanners installed years ago and configured once, where changing the symbology means revisiting every reader
  • Paper forms, job cards and file covers printed on an ordinary office laser printer alongside the text they belong to
  • Passes, gate tickets and internal document numbers that have to be legible after being folded into a pocket

How it compares

Code 128 is the direct comparison, and the honest way to make it is in modules, because that is what you are trading. A Code 39 character costs sixteen modules — nine elements plus the narrow gap that separates it from the next one — against eleven for a Code 128 character in its letters-and-digits set. Add the start and stop patterns and a ten-character asset tag is 192 modules of Code 39 against 145 of Code 128, about a third wider. On pure digits the gap stops being a matter of degree: Code 128 switches to a numeric set that packs two digits into eleven modules, five and a half per digit, so the same ten digits take 192 modules in Code 39 and 90 in Code 128. What you buy for that width is the absence of machinery. Code 39 has no computed check character to get wrong, no code sets to shift between, and each character carries a fixed shape — exactly three wide elements out of nine — so a printing defect turns a character invalid rather than turning it into a different valid one. Code 128 wins on width, on character set and on built-in error checking; Code 39 is the one that keeps working when nothing about the setup is under your control.

Common mistakes

  • Typing the asterisks. Code 39 uses an asterisk as its start and stop character, and because barcode fonts require you to type them, half the internet says a Code 39 value must be wrapped in them. Not here: the encoder adds them itself, and it prints them in the human-readable line, so a symbol built from CODE39 reads *CODE39* underneath. Paste *CODE39* into the field instead and the status line answers that the character asterisk is not allowed at position 1, no symbol is drawn and the download buttons stay disabled.
  • Sending it lowercase. The alphabet has no lowercase letters at all, so a value copied out of a database in mixed case is rejected on its first lowercase character with the position called out. There is a convention called Full ASCII Code 39 that expresses lowercase and punctuation as two-character sequences built on the shift marks, but it only decodes on a reader explicitly set to expect it, and this generator does not build those sequences. If the value has to keep its case, the symbology to use is Code 128.
  • Assuming a check character is in there. Code 39 makes its mod-43 check character optional, and this generator leaves it out — the specification table on this page says so in as many words, under Check digit. That matters when the receiving system was configured to expect one, because it will strip your last character and read the rest. The fix is arithmetic on your side, and it is short enough for a spreadsheet column. Every character carries a value in the order the alphabet runs: 0 to 9 are 0 to 9, A to Z are 10 to 35, then minus 36, full stop 37, space 38, dollar 39, slash 40, plus 41 and percent 42. Add up the values of the characters in your value, take the remainder modulo 43, and the character holding that remainder is the check character. CODE39 comes to 12 + 24 + 13 + 14 + 3 + 9 = 75; 75 modulo 43 is 32; 32 is W, so the value to type is CODE39W. The field takes it, because all 43 possible check characters are already in the accepted alphabet.
  • Letting the width set the module size instead of the other way round. Sixteen modules a character adds up fast: ten characters plus start and stop is 192 modules, and squeezed into a 40 mm space on a label that puts the narrow element at 0.208 mm. A 300 dpi laser lays down a dot of 0.085 mm, so the narrow element is two and a half dots wide and each bar rounds to a different whole number. Decide the narrow element first — three dots is a floor you can defend — then see how many characters fit, and shorten the numbering scheme if they do not.
  • Rebuilding the symbol at a tighter wide-to-narrow ratio. The ratio between a wide element and a narrow one is not fixed at a single value: ISO/IEC 16388 lets it sit anywhere from 2:1 to 3:1 while the narrow element is 0.508 mm or wider, and raises the floor to 2.25:1 as soon as the narrow element goes below 0.508 mm. This generator draws 3:1. Regenerate the same value with a font set to 2:1 and it fits in less space, which looks like a win until the printer or the scanner has a bad day — the extra width is exactly the margin that made you pick Code 39.

Frequently asked questions

Do I have to register anything to use Code 39?
No, and that is the whole point of it. There is no company prefix, no issuing body and no annual membership behind a Code 39 value — the numbering is yours to define. That freedom is also its boundary: because nobody guarantees your number is unique, it means nothing outside your own systems. The moment the code has to be understood by a shop, a distributor or a marketplace, the symbology stops being the question and the number starts being one, and you are looking at EAN-13, UPC-A or ITF-14 instead.
Code 39 or Code 128?
Code 128 unless something specific stops you. It is about a third narrower on letters and roughly twice as compact on an all-digit value, and it takes lowercase and punctuation that Code 39 cannot express. Code 39 earns its place in three situations: the readers on the floor are already configured for it and reconfiguring them is a project, the printing is rough enough that wide bars are worth the space, or the symbol has to be produced by something that cannot compute a check character.
Can I put an underscore, a comma or brackets in the value?
No. The accepted set is the 43 characters of the symbology and nothing else: digits, capital A to Z, the space, and minus, full stop, dollar, slash, plus and percent. Anything outside it is refused with the offending character and its position named in the status line. Inventory numbers picked up from other systems are the usual source of trouble here — underscores and brackets are common in them and neither exists in Code 39. Substitute a minus or a full stop, both of which the alphabet has.
How long can the value be?
This field takes from 1 to 43 characters, and anything longer is rejected on length. Well before that ceiling the label becomes the real limit: at sixteen modules a character, a 30-character value is 512 modules including start and stop, and on a 100 mm label that leaves a narrow element under 0.2 mm. If a value is running long, reworking the numbering scheme is cheaper than moving the whole range onto a bigger label.
Is Code 3 of 9 a different symbology?
It is the same one under another name. Code 39, Code 3 of 9, USS-39 and the LOGMARS symbology used in United States defence logistics all describe the same encoding — the name Code 3 of 9 comes from its structure, three wide elements out of nine per character. If a specification you have been sent names any of these, this generator produces it.