Barcode Generator

Small-business owners, warehouse leads, and publishers use this generator to turn SKUs, GTINs, and ISBNs into scannable symbols without installing desktop label software. Encoding runs locally, so unreleased product codes stay on your machine. Export a vector SVG for the label designer or a PNG for spreadsheets and packing slips.

How Barcode Encoding Works in Your Browser

A barcode is a sequence of black bars and white spaces whose widths map to numeric codes. Every symbology defines its own alphabet of width patterns, a checksum rule, and a start/stop sequence that tells the scanner where the symbol begins. This page implements those tables in TypeScript: your input is converted to a list of module widths, the widths become an on-screen SVG, and the same geometry is stamped onto a canvas when you export a PNG.

Nothing is rendered through an image API or a third-party generator service. Because the pattern is pure vector data, the SVG stays sharp at any print size, and the PNG export inherits the exact same module boundaries the scanner will see.

Code 128 and Code 39: 1D text encodings

Code 128 set B starts with the 104 start pattern, maps each printable ASCII character to a value between 32 and 126, appends a modulo-103 check character, and closes with the 13-module stop pattern. Code 39 uses a fixed nine-element pattern per character with wide bars marked at three modules, surrounds the data with asterisk start/stop characters, and needs no checksum. Code 39 symbols are longer but easier to hand-assemble in legacy systems.

EAN-13 and UPC-A: retail number systems

Retail symbols always encode digits. EAN-13 splits its thirteen digits across a left group that switches between L and G encodings (driven by the parity pattern of the first digit), a center guard, a right group in R encoding, and end guards, for 95 modules total. UPC-A is the twelve-digit North American sibling and can be treated as an EAN-13 with a leading zero. Both reject a wrong check digit before drawing anything.

From raw code value to exported file

Input value WIDGET-128 in Code 128B becomes a start pattern, one pattern per character, a check pattern, and a stop pattern. The preview and downloads share the same module string:

Input
symbology: code128b
value:     WIDGET-128
Encoded modules (excerpt)
start  104  -> 11010010000
'W'     55  -> 10000110100
...
stop        -> 1100011101011

Use Cases

Developer Production Workflow
Generate fixture barcodes for scanner integration tests Print Code 128 bin labels for a new warehouse aisle Add EAN-13 symbols to packaging proof sheets
Batch-build SKU labels from a CSV of product codes Apply UPC-A codes to retail-ready inventory Reprint damaged asset tags without design software
Verify check-digit logic against the GS1 specification Stick library ISBN-style EAN-13 codes on backlist titles Hand a vector file to a print vendor for label runs

Common Mistakes and Troubleshooting

Entering a thirteen-digit EAN whose final digit is wrong throws a check-digit error instead of drawing a symbol scanners will refuse. Fix the last digit or delete it so the generator recomputes it. Lowercase letters are rejected under Code 39 because that symbology has no lowercase alphabet; switch to Code 128 or uppercase the value.

Designers often place logos or text inside the white border around the bars. That border is the quiet zone, at least ten modules wide, and covering it is one of the most common reasons a printed symbol scans intermittently. When a barcode prints too small, bars merge and the scanner reads partial data; enlarge the symbol rather than increasing contrast alone. Non-ASCII characters such as emoji are outside Code 128B range and are rejected with a clear message.

Best Practices for Scannable Labels

Pick the symbology the reader expects: EAN-13 or UPC-A at retail checkout, Code 128 for logistics and internal tracking. Keep the quiet zone clear and size the module width so the narrowest bar exceeds the scanner's minimum, usually 0.25 mm for handheld lasers. Export SVG for anything sent to a print vendor, since vectors reflow cleanly at any label size, and reserve PNG for office documents.

Store the encoded value next to the artwork in your DAM or label database so a mismatched caption is caught before a print run. Test a sample from the actual printer, paper stock, and label size, because glossy substrates and thermal printers shift bar edges. If codes will be scanned through shrink wrap or cold storage film, validate on-site before committing to a full run.

Barcode Generator FAQ

Which barcode type should I choose for my product labels?

For retail products sold in stores, use EAN-13 (international) or UPC-A (North America) because point-of-sale scanners expect those formats. For internal inventory, asset tags, or shipping labels, Code 128 is the best default because it encodes any printable ASCII character in a compact symbol. Code 39 is a reasonable pick when your scanner fleet is older or when you need a self-checking symbology with simpler encoding rules.

How is the check digit calculated for EAN-13 and UPC-A?

EAN-13 multiplies the first twelve digits alternately by 1 and 3, sums them, and sets the thirteenth digit so the total lands on a multiple of ten. UPC-A does the same over its first eleven digits and stores the result as the twelfth digit. This generator computes the check digit automatically when you enter twelve (EAN) or eleven (UPC) digits, and it rejects a full code whose final digit does not match.

Can I download the barcode as a PNG for printing?

Yes. The SVG download keeps the symbol as crisp vector geometry that scales to any label size without blur. The PNG option rasterizes the same module pattern onto a canvas at a fixed resolution, which is convenient for word processors, spreadsheet mail merges, and tools that do not accept SVG. Both files include the standard ten-module quiet zone on each side.

Why does my Code 128 barcode fail to scan after printing too small?

Scanners need a minimum module width, typically around 0.25 mm for laser scanners at close range. When you shrink a barcode, every bar and space shrinks with it, and reflections bleed together. Increase the printed width, raise the bar height so the scan line can cross the symbol at an angle, and keep the quiet zone clear of text or graphics.

Does this barcode generator upload my data anywhere?

No. All encoding happens with plain TypeScript running in your browser. The digit strings you type never leave the page, which makes the tool suitable for internal SKUs, pre-release product codes, and anything under NDA. Closing the tab discards the data.

What characters can Code 128 and Code 39 encode?

Code 128 set B accepts the full printable ASCII range from space through tilde, so it handles lowercase letters, punctuation, and symbols like SKU-2026_a. Code 39 is narrower: digits, uppercase letters, space, and the six symbols - . $ / + %. If your data contains lowercase text and you need Code 39, convert it to uppercase first or switch the symbology to Code 128.

Can I put a human-readable number under the bars?

The preview and both downloads append the encoded value in a monospace caption below the bars when the text option is enabled. Retail standards for EAN and UPC usually require that caption to match the digits exactly, so the generator prints the full code including the computed check digit. For Code 128 you can turn the caption off if your labeling workflow adds its own text.