Code 39 Generator
Generate Code 39 (3 of 9) barcodes online. Customize width, height, checksum, and download as PNG or SVG. Free barcode maker.
About
Code 39 (also called Code 3 of 9) is a variable-length, discrete barcode symbology defined in ISO/IEC 16388. Each character is encoded as 9 elements - 5 bars and 4 spaces - of which exactly 3 are wide. The symbology supports 43 characters: uppercase A - Z, digits 0 - 9, and symbols - . $ / + % SPACE. The asterisk * serves exclusively as start/stop delimiter and must not appear in payload data. An incorrect narrow-to-wide ratio or omitted quiet zone causes scanner read failures. This tool generates specification-compliant barcodes with optional modulo-43 check digit computation.
The optional check digit improves error detection but is not required by the base specification. Some industries (U.S. Department of Defense LOGMARS, HIBC) mandate it. This generator assumes a minimum quiet zone of 10ร the narrow bar width on each side, per ISO/IEC 16388 ยง6.3.4. Rendered output is pixel-aligned to prevent anti-aliasing artifacts that degrade scan reliability.
Formulas
The optional check digit is computed using modulo-43 arithmetic over the encoded payload:
where vi is the numeric value (0 - 42) assigned to the i-th character, and n is the payload length. The character corresponding to value C is appended before the stop character. Total barcode width in modules: W = (n + 2) ร (6w + 3r) + (n + 1) ร g, where w = wide element width, r = narrow element width, and g = inter-character gap (typically 1 narrow unit).
Reference Data
| Character | Pattern (N=narrow, W=wide) | Value (mod 43) |
|---|---|---|
| 0 | NnNwWnWnN | 0 |
| 1 | WnNwNnNnW | 1 |
| 2 | NnWwNnNnW | 2 |
| 3 | WnWwNnNnN | 3 |
| 4 | NnNwWnNnW | 4 |
| 5 | WnNwWnNnN | 5 |
| 6 | NnWwWnNnN | 6 |
| 7 | NnNwNnWnW | 7 |
| 8 | WnNwNnWnN | 8 |
| 9 | NnWwNnWnN | 9 |
| A | WnNnNwNnW | 10 |
| B | NnWnNwNnW | 11 |
| C | WnWnNwNnN | 12 |
| D | NnNnWwNnW | 13 |
| E | WnNnWwNnN | 14 |
| F | NnWnWwNnN | 15 |
| G | NnNnNwWnW | 16 |
| H | WnNnNwWnN | 17 |
| I | NnWnNwWnN | 18 |
| J | NnNnWwWnN | 19 |
| K | WnNnNnNwW | 20 |
| L | NnWnNnNwW | 21 |
| M | WnWnNnNwN | 22 |
| N | NnNnWnNwW | 23 |
| O | WnNnWnNwN | 24 |
| P | NnWnWnNwN | 25 |
| Q | NnNnNnWwW | 26 |
| R | WnNnNnWwN | 27 |
| S | NnWnNnWwN | 28 |
| T | NnNnWnWwN | 29 |
| U | WwNnNnNnW | 30 |
| V | NwWnNnNnW | 31 |
| W | WwWnNnNnN | 32 |
| X | NwNnWnNnW | 33 |
| Y | WwNnWnNnN | 34 |
| Z | NwWnWnNnN | 35 |
| - | NwNnNnWnW | 36 |
| . | WwNnNnWnN | 37 |
| SPACE | NwWnNnWnN | 38 |
| $ | NwNwNwNnN | 39 |
| / | NwNwNnNwN | 40 |
| + | NwNnNwNwN | 41 |
| % | NnNwNwNwN | 42 |
| * (Start/Stop) | NwNnWnWnN | - |