Generate a scannable 1D barcode in Code 128, EAN-13, EAN-8, UPC-A, or Code 39 format. Adjust width and height, then download as PNG or SVG — all rendered in your browser.
Any letters, numbers, and most symbols — the most flexible general-purpose barcode.
Enter a valid value to generate a barcode.
A one-dimensional (1D) barcode encodes data as a series of parallel black bars and white spaces of varying widths, readable in a single horizontal scan line — the familiar striped pattern found on nearly every retail product. This is fundamentally different from a two-dimensional code like a QR code, which packs data into a grid pattern read both horizontally and vertically at once, allowing it to store far more information in the same physical space. 1D barcodes remain the global standard for retail products specifically because the entire supply chain — point-of-sale scanners, inventory systems, shipping labels — has standardized around a small handful of 1D formats (EAN, UPC, Code 128, Code 39) for decades, and switching to 2D codes industry-wide would require replacing enormous amounts of existing scanning hardware and software.
This tool uses bwip-js, an open-source JavaScript library that implements over 100 barcode symbologies according to their official published specifications, running entirely in your browser. When you choose a barcode type and enter a value, bwip-js validates your input against that symbology's exact rules (character set, length, checksum), calculates the correct bar-and-space pattern, and renders it either onto an HTML canvas (for the live preview and PNG download) or as SVG markup (for the vector download) — all synchronously, without any network request. This is the same barcode engine used by many production systems, so a barcode generated here follows the same official specification a real point-of-sale scanner or warehouse system expects.
EAN-13, EAN-8, and UPC-A all include a mathematical checksum as their final digit, calculated from all the preceding digits using a specific weighted formula defined in each standard. This checksum lets a scanner detect a misread instantly — if the scanned digits don't produce the expected checksum, the scanner knows the read failed and can retry, rather than silently accepting a corrupted or misread value. When you type a full-length EAN or UPC number into this tool, it verifies your final digit against the calculated checksum and shows an error if it doesn't match, catching the same class of error a real-world scanner would eventually flag — just before printing, rather than after distributing a defective barcode.
Retail products being sold through a store or marketplace need EAN-13 (most of the world) or UPC-A (North America), since retail point-of-sale systems and marketplaces like Amazon specifically require one of these registered, globally-unique formats. Small packaging that can't fit a full EAN-13 uses EAN-8, a shortened variant built for exactly this constraint. Everything else — internal inventory codes, warehouse bin labels, employee ID badges, event tickets, asset tracking tags, shipping and logistics labels — is typically better served by Code 128 or Code 39, since these general-purpose formats don't require registering a number with any external standards body and can encode any value you choose to assign. Code 128 is the more modern, more space-efficient choice between the two and is generally preferred unless you're working with legacy systems or hardware specifically built around Code 39.
A barcode that scans perfectly on your screen can still fail in the real world if it's printed too small, too low-resolution, or without adequate quiet space (blank margin) around it — scanners rely on clean transitions between bars and background, and cramped or blurry printing degrades that signal. As a general guideline, keep the module width (this tool's Width control) large enough that the narrowest bar remains solidly printed and distinguishable at your printer's actual resolution, use a generous height especially for barcodes that will be scanned by handheld devices at varying angles, and always leave clear white space immediately around the barcode with no other printed content overlapping or crowding it. Before mass-printing any barcode for real-world use, test-scan a sample print with the actual scanner and printer you'll be using in production, since screen previews can look scannable even when a specific print combination introduces issues a screen can't reveal.
Barcode Generator produces traditional 1D barcodes for retail and logistics use cases. These related tools cover other encoding and image generation needs.