Code 39 barcode generator

Paste a list and get one Code 39 barcode per line, as SVG or PNG files or a print sheet. Use Code 39 when a scanner, database or customer specification asks for it by name. For anything else, Code 128 makes a shorter barcode from the same text.

Or build a numbered sequence

The 43 characters Code 39 can hold

Code 39 is defined in ISO/IEC 16388. It has a fixed set of 43 data characters. Each one also has a value from 0 to 42, which matters only for the optional check character described further down.

CharactersValues
Digits 0 to 90 to 9
Capital letters A to Z10 to 35
- (hyphen)36
. (full stop)37
space38
$ / + %39, 40, 41, 42

There are no lower-case letters. The generator turns lower case into capitals for you, so ab-1 is drawn and printed as AB-1, and the scanner returns capitals. Anything outside the 43, such as an underscore, # or @, is rejected with a red note naming the character.

Start and stop: the asterisk

Every Code 39 barcode begins and ends with the pattern for an asterisk. Scanners use it to find the barcode and to tell which way round they are reading it, and they do not include it in the text they send. That is why the asterisk cannot appear inside a value.

If you used to print Code 39 with a barcode font, you may be used to typing the asterisks yourself, as in *ABC*. Leave them out here. The generator adds the start and stop patterns on its own, and a line with an asterisk in it is rejected as an unsupported character.

Why Code 39 is so wide

Each Code 39 character is drawn with 9 elements, 5 bars and 4 spaces, and exactly 3 of the 9 are wide. That rule gave the format its other name, Code 3 of 9. The standard allows a wide element to be from 2 to 3 times the narrow one. This generator uses 3 to 1, the widest ratio, which keeps wide and narrow elements easy to tell apart on rough print.

At 3 to 1, one character is 6 narrow plus 3 wide elements, or 15 modules, plus a narrow gap before the next character: 16 modules per character, and 2 extra characters for the asterisks. A Code 128 character is 11 modules, and in Code 128 two digits share one character. The widths below come from the generator at a bar width of 2 px:

ValueCode 39Code 128
SKU-1001159 modules, about 95 mm112 modules, about 70 mm
AST-00417175 modules, about 103 mm134 modules, about 81 mm
12345678901234255 modules, about 146 mm112 modules, about 70 mm

The printed widths include the white margins. On a small label, Code 39 often forces you down to a 1 px bar width, so keep its values short. At 1 px, a value of up to about seven characters fits on a 50 mm label.

The format has one advantage that explains its long life. It is self-checking: each character has exactly 3 wide elements out of 9, so a single misread element produces an invalid pattern rather than a different valid character. That is also why its check character is optional.

The optional mod 43 check character

Some systems expect a check character at the end of every Code 39 barcode. This generator does not add one, but you can add it yourself, because it is an ordinary Code 39 character placed before the stop pattern. To work it out, add up the values of all the characters, divide by 43 and look up the character whose value is the remainder.

CharacterCODE39Total
Value122413143975

75 divided by 43 leaves 32, and the character with value 32 is W. So if your scanner is set to require a check character, type CODE39W instead of CODE39. The scanner checks the last character and, depending on its settings, either removes it or passes it on with the rest. Find out which one your software expects before you print. Note that the text under the bars will also show the W.

If your scanner requires a check character and your labels do not have one, nothing scans at all. The fix is to switch that setting off in the scanner, which is usually done by scanning a setting barcode from its manual.

Full ASCII mode: a setting to check

An extension called Full ASCII Code 39 encodes lower-case letters and other symbols as pairs of normal characters, such as +A for a lower-case a. A scanner with Full ASCII switched on reads those pairs and replaces them. The generator draws standard Code 39, not Full ASCII, so this matters only on the scanning side.

If a value contains $, %, / or + followed by a letter, a scanner in Full ASCII mode will change it. PART+B comes out as PARTb, and $M turns into a control character instead of two letters. Either switch Full ASCII off on the scanner or keep those symbols out of your values. If the scanned text differs from the text under the bars, this is one of the first settings to check, along with the others in the troubleshooting checklist.

Where Code 39 is still used

  • ID badges and membership cards printed for older access, time-clock and library systems that were set up to read Code 39.
  • Asset tags on equipment in schools, hospitals and offices whose asset registers date from before Code 128 was common.
  • Industry labels, including the US Department of Defense LOGMARS labels and parts labels under older automotive standards.
  • Older warehouse and ERP systems, and scanners configured years ago for Code 39 only.

If none of these applies and you are starting fresh, choose the Code 128 barcode generator instead. It holds lower case, prints shorter and has a check symbol built in. The barcode types guide compares all five formats this site makes.

Frequently asked questions

Can Code 39 hold lower-case letters?

Standard Code 39 cannot. The generator converts lower case to capitals before drawing. Full ASCII Code 39 can carry lower case as pairs of characters, but this generator does not make it.

Should I type the asterisks?

No. The generator adds the start and stop asterisks itself, and a value with an asterisk in it is rejected.

Does this generator add the mod 43 check character?

No. If your system needs it, work it out as shown on this page and type it as the last character of each value.

Why is my Code 39 barcode wider than Code 128?

Each Code 39 character takes 16 modules here, against 11 for Code 128, and Code 128 also packs two digits into one character. The same value is often 40% wider or more in Code 39.

Is Code 39 the same as Code 3 of 9?

Yes. Code 3 of 9 is an older name for the same format, after the 3 wide elements in every 9.

Back to the tool