Xerobit

Code 39 Barcode Generator

Enter your data to generate a Code 39 barcode as a scalable SVG image. This code 39 barcode generator supports digits, uppercase letters and seven special characters, with an optional modulo 43 check digit. Everything runs locally in your browser and nothing is uploaded.

Appends a check character computed with the mod 43 algorithm.

Barcode

*HELLO*
  • Encoded value
    *HELLO*
  • Check digit
    None
  • Characters encoded
    5
  • SVG width
    262 px
  • SVG height
    100 px

How to use the code 39 barcode generator

  1. Type your data using digits, uppercase letters or the allowed symbols: space, hyphen, period, dollar sign, slash, plus and percent.
  2. Check Modulo 43 check digit if your application requires error detection.
  3. Adjust the bar height and choose whether to display the human-readable text below the bars.
  4. 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.

IndexCharacterIndexCharacterIndexCharacter
0015F30U
1116G31V
2217H32W
3318I33X
4419J34Y
5520K35Z
6621L36- (hyphen)
7722M37. (period)
8823N38(space)
9924O39$ (dollar)
10A25P40/ (slash)
11B26Q41+ (plus)
12C27R42% (percent)
13D28S
14E29T

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.

ExampleInputResult
Simple wordData: HELLO; Modulo 43 check digit: no; Bar height (px): 80; Show text below barcode: yes; Background: whiteEncoded value: *HELLO*; Check digit: None; Characters encoded: 5; SVG width: 262 px; SVG height: 100 px
With check digitData: 12345; Modulo 43 check digit: yes; Bar height (px): 80; Show text below barcode: yes; Background: whiteEncoded value: *12345F*; Check digit: F; Characters encoded: 5; SVG width: 294 px; SVG height: 100 px
Mixed charactersData: A-1.B$2/C+3; Modulo 43 check digit: no; Bar height (px): 100; Show text below barcode: yes; Background: whiteEncoded value: *A-1.B$2/C+3*; Check digit: None; Characters encoded: 11; SVG width: 454 px; SVG height: 120 px
No text, transparentData: TEST; Modulo 43 check digit: no; Bar height (px): 60; Show text below barcode: no; Background: transparentEncoded 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.