Xerobit

Codabar Barcode Generator

Enter your data to generate a Codabar barcode rendered as an SVG image. Codabar uses start and stop characters (A, B, C or D) and encodes digits plus a few symbols. This codabar barcode generator runs entirely in your browser so nothing is uploaded to any server.

Result

A123456B
A123456B
  • Encoded string
    A123456B
  • Total width
    202 px

    Includes 20 px quiet zones

  • Modules
    81
  • Narrow bar
    2 px
  • Bar height
    80 px
  1. Start: A
  2. Data: 123456
  3. Stop: B
  4. Full: A123456B

How to use the codabar barcode generator

  1. Type the digits or allowed symbols into the Data field.
  2. Pick a Start character and Stop character from A, B, C or D.
  3. Adjust the narrow bar width and bar height if you need specific dimensions.
  4. Click Generate to render the Codabar barcode as an SVG.
  5. 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:

CharacterPattern (N = narrow, W = wide)
0N N N N N W W
1N N N N W W N
2N N N W N N W
3W W N N N N N
4N N W N N W N
5W N N N N W N
6N W N N N N W
7N W N N W N N
8N W W N N N N
9W 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

ExampleInputResult
Library bookData: 123456; Start character: A; Stop character: B; Narrow bar width (px): 2; Bar height (px): 80; Background: whiteEncoded string: A123456B; Total width: 202 px; Modules: 81; Narrow bar: 2 px; Bar height: 80 px
Blood bank labelData: 9876543; Start character: C; Stop character: D; Narrow bar width (px): 2; Bar height (px): 60; Background: whiteEncoded string: C9876543D; Total width: 222 px; Modules: 91; Narrow bar: 2 px; Bar height: 60 px
Photo lab envelopeData: 001122; Start character: B; Stop character: A; Narrow bar width (px): 3; Bar height (px): 100; Background: transparentEncoded 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.