What Is CODE49? Capacity, Generator and Reader
CODE49 stacks a barcode into 2 to 8 rows. Measured capacity (81 digits, 49 capitals, 25 lowercase), plus how to create one and read it back.
Contents
Spec sheets for equipment and lists of symbologies supported by industrial scanners sometimes include “Code 49” next to CODE39 and CODE128. The number makes it sound like a relative of CODE39, but it looks nothing like it. Wide barcodes are stacked in 2 to 8 rows, with thin horizontal bars separating one row from the next.
CODE49 was invented in 1987 by David Allais at Intermec and is considered the first “stacked” (multi-row) barcode. Allais also created CODE39 and CODE93, and his idea of fitting data that would make a single barcode too long by stacking it in rows instead of widening it was later carried on by PDF417. The current specification is AIM’s USS Code 49 (ANSI/AIM BC6). It is not used in many places today, but if existing equipment or a label specification calls for CODE49, you have to produce exactly that.
In this article we measure how many characters CODE49 holds and what drives the number of rows. Then, using the English UI, we walk through creating a code with the in-browser CODE49 Generator, reading it back with the CODE49 Reader to check that the content matches, and collecting codes into a PDF for labels with CSV to CODE49 bulk PDF. All of these tools run entirely in your browser; the text and images you enter are not sent anywhere.
One row holds 7 characters: working out the capacity from the structure
Looking at how CODE49 is built first makes the capacity numbers easier to understand. According to descriptions of the specification (such as Seagull Scientific’s barcode guide), each row consists of a start pattern, four symbol characters and a stop pattern, and every row is fixed at 70 modules (70 narrow bar widths). The four symbol characters represent 8 characters, one of which is a per-row check character, so each row carries 7 characters of data.
The last row holds the check characters for the whole symbol and the row count. The check characters are added automatically, but unlike a QR code there is no error correction to recover from dirt or damage. If any row cannot be read, the whole code cannot be read.
The character set is the 128 ASCII characters (codes 0–127): letters, digits and symbols, plus control characters such as line feed and tab. However, only digits, uppercase letters and some symbols fit directly into a single character slot. Lowercase letters, line feeds and the like are preceded by a “shift” character and use two slots. Runs of digits, on the other hand, are packed more tightly in a dedicated numeric mode. These differences show up directly in the measurements below.
Digits went up to 81, uppercase to 49, lowercase to 25
Using the same encoder the CODE49 Generator uses internally (bwip-js), we added one character of the same kind at a time and recorded when the row count increased and when the text no longer fit.
Each number in the table is the maximum number of characters that fit within that many rows (the 8-row column is the overall limit).
| Character type | 2 rows | 3 rows | 4 rows | 5 rows | 6 rows | 7 rows | 8 rows |
|---|---|---|---|---|---|---|---|
| Digits | 15 | 26 | 38 | 50 | 61 | 70 | 81 |
| Uppercase letters | 9 | 16 | 23 | 30 | 37 | 42 | 49 |
| Lowercase letters | 5 | 8 | 12 | 15 | 19 | 21 | 25 |
With digits only, a 14-digit GTIN or a 13-digit EAN-13 number fits in 2 rows. For uppercase letters the limit is 49: 7 characters × 8 rows = 56, minus the space for the control information in the last row. Lowercase stops at 25, roughly half, which confirms that each lowercase letter takes two slots.
Comparing inputs of the same length makes the difference clear.
| Input (14 characters) | Rows |
|---|---|
12345678901234 |
2 rows |
ABCDEFGHIJKLMN |
3 rows |
abcdefghijklmn |
5 rows |
https://www.ixam.net/ (21 characters) |
6 rows |
A URL is mostly lowercase letters and symbols, so 21 characters already used 6 rows. A lowercase URL tops out at around 28 characters, which makes CODE49 impractical for URLs. If you want to print a URL, a QR code is the better choice.
Creating a CODE49 with the generator
Now for the actual steps. As an example we enter two lines of data, a lot number and an expiry date, separated by a line break.
-
Open the CODE49 Generator and type the following two lines into “Text or URL to encode in CODE49”.
LOT A123 EXP 2027-03 -
Leave “Number of rows” at “Auto (2–8 rows)”. The preview updates as you type, and below it you see “4 rows / 20 ASCII characters / saved size 267 × 135 px”. The line break counts as one character: 8 characters + line break + 11 characters = 20.
-
Save the image with “Save as PNG”. If you plan to enlarge it for printing, choose “Save as SVG”, which keeps the edges sharp.
“Row height” is the height of one row, and its default is the specification’s minimum of 8 modules. If the scanner is moved by hand, or reading is unreliable because the rows are too short, increase this value to make the code taller. “Size” sets how many pixels one narrow bar takes, and “Extra margin” adds space on all four sides on top of the margin required by the specification.
When we changed the same content to lowercase, lot a123 and exp 2027-03, the code grew from 4 rows to 5. Both versions are 20 characters long, so the difference comes only from the extra slots lowercase letters use.
If you enter anything outside ASCII, such as accented letters (é, ü, ñ), curly quotes, CJK characters or emoji, the tool shows an error instead of creating a code. It never silently replaces or drops characters, so when you see an error, check your input, or use a QR code or PDF417, which can hold those characters.
Reading it back to check that even the line break matches
Before printing the code or pasting it into a label specification, read it back to confirm it contains the string you intended. You cannot tell what a CODE49 holds by looking at it, so this check is the only evidence you have.
- Open the CODE49 Reader and select the PNG you saved with “Choose File”. You can also drag and drop the image or paste a copied image. Reading starts as soon as the image is selected.
- “Decoded text” shows the two lines
LOT A123andEXP 2027-03, and below them “4 rows · 20 characters (ASCII)”. - Open “Show control characters” and the line break is displayed by name as
⟦LF⟧. This is where you confirm that what looks like a line break really is LF (0x0A), not a space or a tab.
You can copy the result with “Copy text” or save it as a text file with “Save as TXT”. Both use the original string, before display substitutions such as ⟦LF⟧.
Codes printed on paper or shown on a screen can be read with the camera via “Start camera”. If a code will not read, check that every row and the white margin around the code are in the frame and that the code is level. The reader does not correct perspective distortion, so photos taken at an angle or photos that include other text tend to fail. Cropping the image to a single code plus its margin usually fixes it.
Turning a CSV list into a PDF for label sheets
To make labels in bulk from a list of part numbers or asset numbers, use CSV to CODE49 bulk PDF. It opens with three sample records already filled in, so you can try the whole flow as is.
Item A,0012345678905
"Front desk, Bldg 2","DESK-01
FLOOR-2"
Item C,IXAM-0003
The first column is the label caption and the second is the data to encode in CODE49. As in the second record, a cell containing a comma or a line break is treated as a single value, line break included, as long as it is wrapped in double quotes.
- Check that the first column is selected in “Caption column” and the second in “CODE49 data column”. If your CSV has a header row, turn on “Skip the first record (header row)”.
- Leave “Output format” at “PDF (for printing)” and “Paper / label sheet” at the default, A-one 72221 (A4, 21 labels). A-one is a Japanese label brand; the list also includes Avery and HERMA sheets, and “Custom size” lets you enter the dimensions of any other sheet you have.
- Press “Create PDF”. Every record is validated, and the message “Created a 1-page PDF (A-one 72221) with 3 codes.” appears. Save it with “Save PDF”.
In the preview, the first record (13 digits) is 2 rows tall and the second (with a line break) is 3 rows, so the codes are not the same height. CODE49 changes its row count with the content, so if you want all labels to look the same, fix the row count with “Number of rows”. Data that does not fit in the fixed number of rows is listed as an error with its line number when you create the PDF, so you only need to review those records.
When printing, print the PDF at “Actual size (100%)” in your printer settings, check the positions on plain paper first, and then print on the label sheet.
Before choosing CODE49, check what the reading side supports
CODE49 is a different format from CODE39 and CODE128, and the similar name does not mean compatibility. Many ordinary smartphone barcode apps and retail POS scanners do not support CODE49. In the example above we put an EAN-13 number into a CODE49, but a checkout scanner will not read it as a product code. If you want it read as EAN/UPC, you need to make an EAN barcode with the Barcode Generator.
If you are free to choose a symbology, think about it by use case:
- Part numbers or IDs of around 10 alphanumeric characters that ordinary scanners must read → CODE128 (how to make one)
- Non-ASCII text, URLs or long data → QR code
- A fair amount of data in a long, narrow strip of space → PDF417 (see how boarding passes use it in the PDF417 article)
- Existing equipment or a business partner’s specification calls for CODE49 → CODE49
Even in that last case, before mass-producing labels, print a test label and scan it with the reader that will actually be used on site. If the bar widths, row height or margins are not sufficient, a code can read fine in the generator and reader here and still fail on the machine in the field.