How to use the code 39 barcode generator
- Type your data using digits, uppercase letters or the allowed symbols: space, hyphen, period, dollar sign, slash, plus and percent.
- Check Modulo 43 check digit if your application requires error detection.
- Adjust the bar height and choose whether to display the human-readable text below the bars.
- Click Generate to render the Code 39 barcode as an SVG you can download or embed.
How Code 39 encoding works
Each character in a Code 39 barcode is represented by nine elements: five bars and four spaces. Exactly three of those nine elements are wide and six are narrow, which gives the symbology its alternative name, 3 of 9. The wide-to-narrow ratio is typically between 1:2 and 1:3; this code 39 barcode generator uses a fixed 1:3 ratio for maximum readability.
A single narrow inter-character gap separates every encoded character. The start and stop markers are always asterisks (*), which are added automatically and should not be typed into the data field.
The modulo 43 check digit
The optional check digit adds error detection. Every valid character has a numeric value from 0 to 42: digits 0 through 9 map to 0 through 9, letters A through Z map to 10 through 35, and the seven symbols (hyphen, period, space, dollar, slash, plus, percent) map to 36 through 42. The asterisk used for start and stop has no numeric value and is excluded from the calculation.
To compute the check character, sum the values of all data characters and divide by 43. The remainder selects the check character from the same table. For example, the string 12345 has values 1 + 2 + 3 + 4 + 5 = 15. Since 15 mod 43 = 15, the check character is the one at index 15, which is F. The final encoded sequence becomes *12345F*.
Character set reference
Code 39 natively supports 43 data characters plus the asterisk delimiter. Below is the complete mapping used by this code 39 barcode generator.
| Index | Character | Index | Character | Index | Character |
|---|---|---|---|---|---|
| 0 | 0 | 15 | F | 30 | U |
| 1 | 1 | 16 | G | 31 | V |
| 2 | 2 | 17 | H | 32 | W |
| 3 | 3 | 18 | I | 33 | X |
| 4 | 4 | 19 | J | 34 | Y |
| 5 | 5 | 20 | K | 35 | Z |
| 6 | 6 | 21 | L | 36 | - (hyphen) |
| 7 | 7 | 22 | M | 37 | . (period) |
| 8 | 8 | 23 | N | 38 | (space) |
| 9 | 9 | 24 | O | 39 | $ (dollar) |
| 10 | A | 25 | P | 40 | / (slash) |
| 11 | B | 26 | Q | 41 | + (plus) |
| 12 | C | 27 | R | 42 | % (percent) |
| 13 | D | 28 | S | ||
| 14 | E | 29 | T |
Common mistakes and edge cases
The most frequent error is entering lowercase letters or unsupported punctuation. Standard Code 39 only supports uppercase A through Z and seven specific symbols. If you need to encode lowercase text or arbitrary ASCII, convert it first or use a different symbology such as the Code 128 barcode generator, which handles the full 128-character ASCII set.
Another mistake is including the asterisk start and stop characters manually. The generator adds them automatically, so typing *DATA* would attempt to encode two extra asterisks as data, which is invalid.
Very long strings produce wide barcodes that may exceed label dimensions. Each data character adds 12 modules (nine element widths plus one gap width at a 1:3 ratio). Plan your label size accordingly, especially when the check digit option is enabled, since it adds one more character.
Where Code 39 is used
Code 39 is widely used in manufacturing, logistics, healthcare and government applications. The United States Department of Defense adopted it as the standard for many labeling requirements, and the Health Industry Bar Code (HIBC) specification is built on Code 39.
Because it does not require a check digit by default, it is straightforward to implement for internal tracking systems. However, adding the modulo 43 check digit is recommended whenever the barcode will be scanned in environments where misreads could cause problems. For retail point-of-sale scanning, UPC formats are required instead; see the UPC generator for that purpose.
Worked examples
Each result below was produced by the same code the tool runs, so you can check your own numbers against them.
| Example | Input | Result |
|---|---|---|
| Simple word | Data: HELLO; Modulo 43 check digit: no; Bar height (px): 80; Show text below barcode: yes; Background: white | Encoded value: *HELLO*; Check digit: None; Characters encoded: 5; SVG width: 262 px; SVG height: 100 px |
| With check digit | Data: 12345; Modulo 43 check digit: yes; Bar height (px): 80; Show text below barcode: yes; Background: white | Encoded value: *12345F*; Check digit: F; Characters encoded: 5; SVG width: 294 px; SVG height: 100 px |
| Mixed characters | Data: A-1.B$2/C+3; Modulo 43 check digit: no; Bar height (px): 100; Show text below barcode: yes; Background: white | Encoded value: *A-1.B$2/C+3*; Check digit: None; Characters encoded: 11; SVG width: 454 px; SVG height: 120 px |
| No text, transparent | Data: TEST; Modulo 43 check digit: no; Bar height (px): 60; Show text below barcode: no; Background: transparent | Encoded value: *TEST*; Check digit: None; Characters encoded: 4; SVG width: 230 px; SVG height: 60 px |
FAQ
What characters does Code 39 support?
Code 39 supports digits 0 through 9, uppercase letters A through Z, and seven special characters: hyphen, period, space, dollar sign, slash, plus sign and percent sign. Lowercase letters are not part of the standard character set.
Do I need to add the asterisk start and stop characters?
No. The asterisks are added automatically by this code 39 barcode generator. You only enter the data payload.
What is the modulo 43 check digit?
It is an optional error-detection character appended before the stop asterisk. It is calculated by summing the numeric values of each data character, dividing by 43, and using the remainder to look up the corresponding character.
Can I use Code 39 for retail products?
Code 39 is not used for retail point-of-sale scanning. Retail products require UPC or EAN barcodes. Code 39 is intended for industrial, logistics and internal tracking applications.
Why is my barcode rejected?
The input likely contains unsupported characters such as lowercase letters, punctuation marks outside the allowed set, or non-ASCII symbols. Remove them or convert the text to uppercase.
How does Code 39 differ from Code 128?
Code 39 encodes 43 characters using a simple wide-and-narrow bar pattern. Code 128 supports the full 128-character ASCII set and produces denser barcodes. Use the Code 128 barcode generator when you need lowercase letters or compact output.
Is any data sent to a server?
No. The entire encoding process happens in your browser. Nothing is uploaded anywhere.