Which barcode type should I use?
Code 128 is the most flexible linear barcode. It can hold letters, digits and punctuation, so it suits asset tags, inventory labels, shipping references, tickets and internal product codes. EAN-13 is the 13-digit barcode printed on retail products across most of the world, and EAN-8 is its shorter version for small packages. The 12-digit UPC-A codes used in North America can be written as EAN-13 by adding a leading zero.
How the barcodes are encoded
The generator implements the encoding rules from the barcode specifications directly in a few kilobytes of JavaScript. For Code 128 it starts in code set B, which covers all printable ASCII characters, and switches to the compact numeric code set C for runs of four or more digits, where each pair of digits takes a single symbol. That keeps barcodes for long numbers noticeably shorter. A modulo-103 check character is calculated and added automatically, followed by the stop pattern. For EAN codes, the first digit selects the pattern of odd and even parity used in the left half, the bars are split by centre guards, and the final digit is a check digit worked out with alternating weights of 1 and 3. Enter 12 digits for EAN-13 (or 7 for EAN-8) and the check digit is added; enter all 13 (or 8) and it is verified.
UPC-A, Code 39 and ITF-14
UPC-A is the 12-digit retail code used in the United States and Canada; it is the same symbol as an EAN-13 that starts with 0, so scanners worldwide read it. Code 39 is an older industrial symbology that encodes capital letters, digits, space and a few symbols between start and stop asterisks; it is self-checking, and an optional modulo-43 check character can be added for extra safety. ITF-14 (interleaved 2 of 5) carries the 14-digit GTIN printed on outer shipping cartons; digits are encoded in pairs, one in the bars and one in the spaces, and the optional bearer bars form a frame that stops partial scans on corrugated board.
Batch generation
Paste a list of values, one per line, and the tool creates a barcode for each with the same type and style. Invalid lines are reported with the reason, and the rest can be downloaded together as a ZIP of PNG or SVG files named after their values. This is handy for asset tags, stock labels and event tickets.
PNG or SVG?
The PNG download is a pixel image at the bar width you choose, good for documents and web pages. The SVG download is a vector image that stays perfectly sharp at any size, which is the better choice for printing labels, packaging and anything that will be scaled. Both include a white quiet zone on each side, the blank margin scanners need to find the start and end of the code.
Printing tips
- Print black bars on a white background; coloured or low-contrast combinations scan poorly.
- Do not stretch the barcode unevenly, and keep the quiet zones clear.
- Test a printed sample with a scanner or a phone barcode app before printing a large batch.
Important: retail product numbers
Anyone can draw an EAN-13 barcode, but selling products through retailers normally requires numbers that are officially licensed to your company by GS1. Made-up numbers may clash with real products. For internal use, Code 128 is the safer choice. For links and longer text, use the QR code generator instead.