How to use the codabar barcode generator
- Type the digits or allowed symbols into the Data field.
- Pick a Start character and Stop character from A, B, C or D.
- Adjust the narrow bar width and bar height if you need specific dimensions.
- Click Generate to render the Codabar barcode as an SVG.
- Copy the SVG markup or save it for printing and scanning.
How Codabar encoding works
Codabar represents each character as a pattern of four bars and three spaces. Every element is either narrow (one unit wide) or wide (typically two to three units). Characters are separated by a narrow space, and the code is self-checking, so a single misread width is normally rejected. For example, the digit 0 is encoded as narrow bar, narrow space, narrow bar, narrow space, narrow bar, wide space, wide bar.
A complete barcode begins with a start character, followed by the data payload, and ends with a stop character. The start and stop characters are drawn from the set A, B, C and D. These do not carry data themselves but tell the scanner where the symbol begins and ends. A quiet zone of at least ten narrow-bar widths must surround the entire symbol so that readers can detect the edges reliably.
Character set reference
Codabar supports sixteen data characters plus four start/stop characters. Here is the full mapping, listing the seven elements (bar, space, bar, space, bar, space, bar) of each character:
| Character | Pattern (N = narrow, W = wide) |
|---|---|
| 0 | N N N N N W W |
| 1 | N N N N W W N |
| 2 | N N N W N N W |
| 3 | W W N N N N N |
| 4 | N N W N N W N |
| 5 | W N N N N W N |
| 6 | N W N N N N W |
| 7 | N W N N W N N |
| 8 | N W W N N N N |
| 9 | W N N W N N N |
| - (hyphen) | N N N W W N N |
| $ (dollar) | N N W W N N N |
| : (colon) | W N N N W N W |
| / (slash) | W N W N N N W |
| . (period) | W N W N W N N |
| + (plus) | N N W N W N W |
| A (start/stop) | N N W W N W N |
| B (start/stop) | N W N W N N W |
| C (start/stop) | N N N W N W W |
| D (start/stop) | N N N W W W N |
Each row lists the sequence of bars and spaces from left to right. Scanners read these transitions to reconstruct the original string.
Where Codabar is used
Although newer symbologies like those produced by a Code 128 barcode generator offer higher density, Codabar remains common in several niches. Blood banks historically used it to label bags. Libraries historically printed Codabar on checkout cards and book spines. Photo processing labs used it on envelopes to track film orders.
The format is also known as NW-7, Monarch, Code 2 of 7, USD-4 and Ames code. If you encounter any of these names, they refer to the same specification. Its simplicity means that even basic laser scanners decode it without firmware updates, which is why legacy systems still rely on it today.
Choosing start and stop characters
The four start/stop characters (A, B, C, D) exist so that different applications can mark their barcodes uniquely. A blood bank might always wrap its identifiers in C and D, while a library uses A and B. The scanner reads the first pattern to determine orientation and then reads until it hits the matching stop pattern.
There is no checksum built into the Codabar specification itself, though some industry profiles add a modulo check digit before the stop character. This codabar barcode generator outputs exactly what you type plus the chosen delimiters, leaving any application-specific check digit logic to your upstream system.
Common mistakes to avoid
The most frequent error is including letters other than A, B, C or D in the data field. Codabar does not encode the full alphabet. If you need uppercase letters throughout your payload, consider using a Code 39 barcode generator instead.
Another issue is setting the narrow bar too small for your printer. If the narrowest element falls below the resolution of the print head, adjacent bars merge and the scanner cannot distinguish them. A narrow width of two pixels on screen translates well for digital display, but for thermal label printers you should match the module width to the dot size of the hardware.
Worked examples
| Example | Input | Result |
|---|---|---|
| Library book | Data: 123456; Start character: A; Stop character: B; Narrow bar width (px): 2; Bar height (px): 80; Background: white | Encoded string: A123456B; Total width: 202 px; Modules: 81; Narrow bar: 2 px; Bar height: 80 px |
| Blood bank label | Data: 9876543; Start character: C; Stop character: D; Narrow bar width (px): 2; Bar height (px): 60; Background: white | Encoded string: C9876543D; Total width: 222 px; Modules: 91; Narrow bar: 2 px; Bar height: 60 px |
| Photo lab envelope | Data: 001122; Start character: B; Stop character: A; Narrow bar width (px): 3; Bar height (px): 100; Background: transparent | Encoded string: B001122A; Total width: 303 px; Modules: 81; Narrow bar: 3 px; Bar height: 100 px |
FAQ
What characters can Codabar encode?
Codabar encodes the digits 0 through 9 and six symbols: hyphen, dollar sign, colon, slash, period and plus. It also uses A, B, C and D exclusively as start and stop markers.
Does Codabar include a check digit?
The base Codabar specification does not define a mandatory check digit. Some applications append a check character before the stop character, but that is application-specific and this tool does not add one.
Can I use lowercase letters in the data?
No. Codabar only supports numeric digits and the six special symbols listed above. Lowercase or uppercase letters beyond A, B, C and D will cause an encoding error.
Why are there four different start/stop characters?
Having four options lets different industries or departments tag their barcodes distinctly. A scanner can verify that a symbol starts and ends with the expected pair, adding a layer of validation.
Is Codabar the same as NW-7?
Yes. NW-7, Monarch, Code 2 of 7, USD-4 and Ames code are all alternative names for the Codabar symbology.
How wide should the quiet zone be?
The quiet zone on each side should be at least ten times the narrow bar width. This blank margin allows the scanner to detect the beginning and end of the symbol accurately.