Barcode Generator Guide (2026): Code 128, UPC-A, EAN-13 & QR Codes Free
A free barcode generator creates scannable 1D and 2D barcodes for retail products, shipping labels, inventory tags, ISBNs, and more. Below: the 7 most common barcode formats (Code 128, Code 39, UPC-A, UPC-E, EAN-13, EAN-8, ITF-14, QR), the difference between 1D and 2D barcodes, ISBN conversion rules, quiet-zone and DPI requirements for reliable scanning, 5 worked examples, and 8 FAQs.
What Is a Barcode Generator?
A barcode generator is a free online tool that takes a string of characters — a product SKU, a URL, a phone number, a tracking number, an ISBN — and renders it as a machine-readable barcode image. The image can be downloaded as PNG or SVG and printed on product labels, shipping boxes, inventory tags, library books, event tickets, or receipts. Toolzie's free barcode generator supports 7 formats in your browser with no signup: Code 128, Code 39, UPC-A, EAN-13, EAN-8, ITF-14, and QR. The barcode is generated entirely client-side using the JsBarcode library, so the data you enter never leaves your device.
The 7 formats fall into two broad categories: 1D barcodes (linear, encode data in horizontal bars) and 2D barcodes (encode data in a matrix of black/white squares). The 6 1D formats above all work with the same scanner hardware and follow the same encoding rules; QR is a 2D code that requires a 2D-capable scanner (every modern smartphone camera can read QR codes natively).
1D vs 2D Barcodes: What's the Difference?
The 1D vs 2D distinction is the single most important concept in barcodes, and it drives every choice you make about format, scanner hardware, and use case.
1D barcodes (linear) encode data in a single row of vertical bars of varying widths. The scanner reads the widths of the bars and the spaces between them, then decodes the pattern as a number or short string. 1D barcodes typically store 12-30 characters and are best for short identifiers: product SKUs, ISBNs, tracking numbers, inventory tags. They are the cheapest to print (any laser or inkjet at 300 DPI works), the most forgiving of print quality issues, and the most widely supported by POS scanners worldwide.
2D barcodes encode data in two dimensions — both horizontally and vertically. The most common 2D format is QR code (Quick Response, invented by Denso Wave in 1994). QR codes can store 4,000+ alphanumeric characters, 7,000+ numeric digits, or binary data including vCards, WiFi credentials, calendar events, and app deep links. A QR code on a business card can encode a full vCard (name, phone, email, address) in a 1-inch square. Modern smartphones can read QR codes with their native camera app — no special scanner hardware required.
Rule of thumb: Use 1D barcodes (UPC, EAN, Code 128) for retail POS, inventory tracking, shipping, and anywhere a short alphanumeric ID is the data. Use QR codes for URLs, contact cards, payment info, app deep links, and anything that needs more than ~30 characters. Don't use QR for retail POS — the scanner infrastructure expects 1D UPC/EAN, and a QR code at the checkout will just confuse the cashier.
The 7 Barcode Formats (When to Use Each)
Toolzie's generator supports 7 formats. Here is what each is for, the data it accepts, and the typical use case.
1. UPC-A (12 digits) — US/Canada retail standard
UPC-A is the 12-digit barcode standard used in the United States and Canada for retail products sold in stores. The first digit is a number system code (usually 0-1 for most products, 3 for drugs, 5 for coupons, 7 for other), the next 5 digits are the manufacturer code (assigned by GS1), the next 5 are the product code (assigned by the manufacturer), and the last digit is a check digit computed with a modulo-10 algorithm. UPC-A is required for any product sold through major retailers in the US and Canada (Walmart, Target, Costco, Loblaws, etc.). You need a paid GS1 company prefix to use a UPC-A in commerce.
2. EAN-13 (13 digits) — International retail standard
EAN-13 is the 13-digit international barcode standard used in the rest of the world (and increasingly in North America for products sold globally). A UPC-A barcode is technically a valid EAN-13 with a leading zero prepended, so any system that reads EAN-13 can read a UPC-A. EAN-13 is required for products sold in the EU, UK, Australia, Japan, and most countries outside North America. The first 3 digits are the GS1 country prefix (0 = US, 1-19 = various, 30-39 = France, 40-44 = Germany, 690-699 = China, 978/979 = books), the next 4-7 digits are the manufacturer code, then the product code, then the check digit.
3. Code 128 — Most flexible alphanumeric (the workhorse)
Code 128 is the most flexible 1D barcode format, supporting the full 128-character ASCII set (uppercase, lowercase, digits, symbols, control codes). It has a high data density (about 2.5x more data per inch than Code 39) and includes a built-in modulo-103 checksum for error detection. Code 128 is the workhorse format for internal inventory tracking, shipping labels, asset tags, library systems, and any application where the data isn't a fixed-format number. It does not require a GS1 prefix for internal use. Code 128 has 3 sub-codesets (A, B, C) — Code B (alphanumeric) is the most common.
4. Code 39 — Older alphanumeric (still used in automotive, military, government)
Code 39 (also called Code 3 of 9) is an older 1D format that supports 43 characters: uppercase A-Z, digits 0-9, and 7 special characters (-, ., space, $, /, +, %). It is widely used in the automotive industry (for VIN labeling), the US Department of Defense (for MIL-STD-129 labels), and the healthcare industry (for blood bag labels and medical device tracking). Code 39 includes an optional modulo-43 checksum. It is less data-dense than Code 128, so for new applications, Code 128 is usually a better choice. Use Code 39 only when you have a contractual or regulatory requirement to use it.
5. EAN-8 (8 digits) — Short retail (for very small packages)
EAN-8 is the 8-digit short form of EAN-13, designed for very small packages where there isn't room for a full EAN-13. The first 2-3 digits are the GS1 country prefix, then 4-5 digits of product code, then the check digit. EAN-8 is used on items like chewing gum, cigarettes, and small cosmetics. Most retailers do not require EAN-8 — they prefer EAN-13 on a smaller scale — but it is still supported as a legacy format. New product launches should default to EAN-13 unless the package is too small for the full barcode to fit at the required size.
6. ITF-14 (14 digits) — Shipping cartons and warehouse
ITF-14 (Interleaved Two of Five, 14-digit) is the GS1 standard for shipping cartons, pallets, and warehouse cases. It is a 2-of-5 symbology that encodes only digits (0-9), and the 14-digit structure includes a 1-digit packaging indicator + 12-digit GTIN + check digit. ITF-14 is printed with thick bars and a carrier (bearer bar) on top and bottom, which makes it more tolerant of printing on rough surfaces like corrugated cardboard. The bars are about 2x the width of UPC-A bars, so the barcode is bigger overall but more scannable from a distance or at an angle.
7. QR Code — 2D, for URLs, contact cards, and large data
QR code (Quick Response) is a 2D matrix barcode that can store 4,000+ alphanumeric characters, 7,000+ numeric digits, or binary data. A single QR code can encode a vCard (full contact card with name, phone, email, address, URL), a WiFi credential (SSID + password + security type), a calendar event, a geolocation, a Bitcoin or crypto address, or a plain URL that opens in the user's browser when scanned. Modern smartphones can read QR codes natively with the camera app — no app install required. For longer data (a multi-line URL with UTM parameters, a vCard, a WiFi password), QR is the only practical choice. For retail POS, use UPC or EAN, not QR.
How to Generate a Barcode (3 Steps)
Generating a barcode with Toolzie's free barcode generator takes about 30 seconds:
- Choose a format from the dropdown or pill bar. Pick Code 128 for most internal use, UPC-A for US/Canada retail, EAN-13 for international retail, QR code for URLs or contact cards, Code 39 for automotive/military/healthcare, ITF-14 for shipping cartons, or EAN-8 for very small packages.
- Enter your data in the input field. The format-specific validator will show an error if the data is invalid (wrong length, bad characters, missing check digit). UPC-A needs exactly 12 digits, EAN-13 exactly 13, EAN-8 exactly 8, ITF-14 exactly 14. Code 128 and QR accept any string up to their respective limits.
- Click Generate and download the result as PNG (for most uses) or SVG (for variable-size printing like product packaging that scales from 1 inch to 6 inches). The barcode image is ready to print, embed in a label, or upload to your product catalog.
The entire process runs in your browser — no data is sent to a server, no account is required, and the generated barcode has no watermark. The JsBarcode library handles the format-specific encoding rules (start/stop characters, checksum calculation, bar widths) automatically.
The ISBN Barcode: EAN-13 with a 978 or 979 Prefix
One of the most common specific use cases for EAN-13 is the ISBN barcode on the back of every book. An ISBN-13 is a standard EAN-13 with the GS1 country prefix 978 (for traditional ISBNs) or 979 (for newer ISBNs assigned after the 978 prefix space filled up).
The structure of a 13-digit ISBN:
- Prefix: 978 or 979 (3 digits)
- Group/registration group: 0-5 (English language), 7 (China), 80-94 (various), 950-989 (various) (1 digit)
- Registrant/publisher code: 2-6 digits depending on the group size
- Publication code: Assigned by the publisher (1-6 digits)
- Check digit: Calculated with a modulo-10 algorithm (1 digit)
Example: ISBN 978-0-13-468599-1 (Effective Java by Joshua Bloch, 3rd Edition) — prefix 978, group 0 (English), registrant 13 (Pearson), publication 468599, check digit 1. To generate this as a barcode, enter the full 13-digit string 9780134685991 into the EAN-13 format. The barcode image will be the standard book-cover barcode at the correct size for the back cover.
In Canada, ISBNs are assigned by Library and Archives Canada (the official Canadian ISBN agency). In the US, by Bowker. In the UK, by Nielsen. The ISBN is free in most countries, though some charge a small fee. The 13-digit ISBN is generated as an EAN-13 barcode for the back cover; the human-readable ISBN (with hyphens) is printed below the barcode.
5 Rules for a Scannable Barcode
A barcode that generates correctly can still fail to scan at the register. The 5 most common reasons for a scan failure, and how to avoid each one:
1. Quiet zone (the white space around the barcode)
The barcode must have a quiet zone — a clear white margin on both the left and right sides — of at least 10x the width of the thinnest bar. Without it, the scanner can't tell where the barcode starts and stops, and will return a "no read" error. For UPC-A at the standard size (the thinnest bar is 0.01 inches / 0.25mm wide), the quiet zone must be at least 0.1 inches / 2.5mm on each side. Print the quiet zone as pure white (#ffffff) — a beige, cream, or off-white background can reduce scanner reliability.
2. Print resolution (DPI)
Print at 300 DPI minimum for any retail or shipping use. Lower resolutions (150 DPI, 72 DPI screen-only) introduce jagged edges on the bars, which the scanner can misread as the wrong width. For variable-size use (e.g., a product label that prints at 1 inch on some packaging and 4 inches on others), use the SVG download — vector PDF/SVG prints crisply at any size. PNG is raster and will pixelate if scaled up beyond its native resolution.
3. Color contrast (black on white, always)
Use black on white for maximum scanner compatibility. The scanner works by measuring the difference in reflectance between the dark bars and the light background — black on white has the highest possible contrast. Avoid yellows, oranges, light blues, light grays, and reds. The dark color doesn't have to be pure black (#000000) but it should be very dark (delta L from the background > 50 in the CIELAB color space). The light color doesn't have to be pure white but it should be very light and not patterned (no watermarks, no logos behind the barcode).
4. Minimum size (the thinnest bar)
The thinnest bar must be at least 0.01 inches wide (0.25mm). Smaller than that and most scanners can't resolve the individual bars. For UPC-A at the standard 100% magnification, the barcode is 1.469 inches wide × 1.02 inches tall (including the human-readable digits below). At 80% magnification (the smallest common size), the barcode is 1.175 inches wide. Below 80% magnification, expect scan failures on cheap laser scanners.
5. Valid data (length, check digit, allowed characters)
Each format has strict rules: UPC-A is exactly 12 digits, EAN-13 is exactly 13, EAN-8 is exactly 8, ITF-14 is exactly 14, Code 39 is uppercase letters + digits + 7 symbols, Code 128 is any ASCII character, QR code is up to 4,000+ alphanumeric chars. The check digit is the last digit in UPC, EAN, and ITF — it must be correct or the scanner will reject the code as invalid. Toolzie's barcode generator validates the data before generating and shows a clear error if the format rejects the input, so you catch invalid data before printing 1,000 labels.
7 Verified Barcode Examples (Format + Data + Use Case)
Seven real examples covering the 7 formats. Each is generated by Toolzie's free barcode generator with the data shown.
| Format | Data | Use Case | Length |
|---|---|---|---|
| UPC-A | 012345678905 | US/Canada retail product | 12 digits |
| EAN-13 | 5901234123457 | International retail product | 13 digits |
| EAN-8 | 12345670 | Small-package retail | 8 digits |
| Code 128 | SKU-2026-A47-B92 | Internal inventory SKU | 15 chars |
| Code 39 | VIN-1HGCM82633A123456 | Automotive VIN label | 22 chars |
| ITF-14 | 10012345678902 | Shipping carton (case of 12) | 14 digits |
| QR Code | https://toolzie.ca/barcode_generator/ | URL link (opens in browser) | 44 chars |
The 7 examples cover the most common real-world barcode uses. UPC-A and EAN-13 are the two retail POS standards (the 0-prefixed UPC-A 012345678905 is a common demo number; the EAN-13 5901234123457 uses Poland's country prefix 590). The Code 128 SKU shows a typical alphanumeric internal tracking code. The Code 39 VIN shows the automotive industry use (DOD-compliant). The ITF-14 starts with a packaging indicator (1 = case) and the rest is the inner EAN-13. The QR code is the canonical "scan to visit URL" example.
Choosing the Right Format for Your Use Case
A decision tree for picking the right format:
1. Selling products in retail stores (US/Canada)?
Use UPC-A. You need a GS1 company prefix (starts at $130 USD/year for a small prefix). The 12-digit UPC-A is the POS scan standard at Walmart, Target, Costco, Loblaws, and every other major retailer. Your barcode is on every product package, and the cashier scans it at checkout.
2. Selling products internationally (outside US/Canada)?
Use EAN-13. International retailers (Carrefour, Tesco, Aldi, Woolworths) expect EAN-13 on the shelf. If you sell both domestically and internationally, you can use the same product with both a UPC-A and an EAN-13 (the UPC-A is the EAN-13 with a leading zero).
3. Printing books for sale?
Use EAN-13 with a 978 or 979 prefix (an ISBN-13). The 13-digit ISBN is generated as a standard EAN-13 barcode. The human-readable ISBN (with hyphens) is printed below the barcode. Get the ISBN from your country's ISBN agency: Library and Archives Canada for Canada, Bowker for the US, Nielsen for the UK.
4. Internal inventory, warehouse, asset tracking?
Use Code 128. It's the most flexible format (full ASCII, high density, built-in checksum), doesn't require a GS1 prefix, and is the workhorse for any internal tracking use. Many warehouse management systems (WMS) and asset-tracking platforms accept Code 128 as the standard.
5. Shipping cartons, pallets, warehouse cases?
Use ITF-14. The thick bars and bearer bars are more tolerant of rough printing on corrugated cardboard. The 14-digit structure includes a packaging indicator (1 = case, 6 = case of cases, 0 = unspecified) and the inner EAN-13.
6. Automotive, military, healthcare (with compliance requirements)?
Use Code 39. It's the legacy standard for the automotive industry (ODETTE, AIAG), the US Department of Defense (MIL-STD-129), and healthcare (HIBCC, ICCBBA). Code 39 is required by many industry compliance standards; you can't use Code 128 even if it's technically better.
7. URL, contact card, WiFi, payment info, app deep link?
Use QR code. The only 2D format in common use, QR is readable by every modern smartphone camera. Encode vCards, WiFi credentials, calendar events, payment addresses, or URLs. The 4,000+ alphanumeric character capacity is enough for any reasonable use case.
Common Barcode Mistakes (and How to Avoid Them)
Five mistakes that turn a working barcode into an unscannable label, and how to fix each.
1. Buying a "barcode" from an unauthorized reseller
A common mistake is to buy a "barcode" from an eBay seller, a barcode shop, or a discount reseller. These numbers are often duplicates of barcodes already assigned to other products, or they are not registered with GS1. Major retailers (Walmart, Target, Amazon) verify that UPC-A codes are registered with GS1; if the code is not in the GS1 database, the product is rejected from the catalog. Always get your UPC-A or EAN-13 from GS1 directly (gs1.org) — yes, the GS1 prefix costs $130+ USD/year, but the alternative is a barcode that won't scan at retail. The barcode image can still be generated for free; the right to use the number in commerce is what GS1 sells.
2. Skipping the check digit calculation
Every UPC-A, EAN-13, EAN-8, and ITF-14 barcode includes a check digit as the last digit. The check digit is calculated with a modulo-10 algorithm over the preceding digits. If you enter the wrong check digit, the scanner will reject the code as invalid even if the rest of the data is correct. The free barcode generator can compute the check digit for you (most implementations auto-calculate it from the preceding 11 digits) — but if you enter a 12-digit UPC-A manually, make sure the last digit is the correct check digit. There's a free check-digit calculator at the bottom of the generator if you need to verify a number you already have.
3. Printing on a busy background
The scanner can't read a barcode printed on top of a logo, a watermark, a textured surface, or a gradient. The barcode must be on a solid, uniform, light background with a clear quiet zone. If your product label has a busy background, place a white box behind the barcode (white rectangular print behind the barcode lines). The white box should be at least the size of the barcode + 10x bar width on each side for the quiet zone.
4. Using the wrong magnification
UPC-A and EAN-13 have a standard magnification factor from 80% to 200%. The 100% (default) size is 1.469 inches wide for UPC-A. Going below 80% is the most common cause of scan failures — the bars are too thin for the scanner to resolve. Going above 200% is fine for large packaging (cases, shipping) but wasteful for retail. For product packaging, stay between 80% and 150% magnification. The generator output should be 100% by default.
5. Forgetting the human-readable digits
Below most 1D barcodes, the data is printed in human-readable digits (the OCR-B font). This is required for retail — the cashier needs to be able to read the number if the scanner fails. The free generator shows the digits below the barcode by default. Don't crop them off the image; the human-readable layer is the backup when scanning fails, and a retailer that sees a barcode without OCR-B digits below it will reject the package.
Try the Free Barcode Generator
Generate Code 128, UPC-A, EAN-13, EAN-8, Code 39, ITF-14, or QR codes in your browser. Free, no signup, no watermark. Download as PNG or SVG. The barcode is generated entirely client-side — your data never leaves your device.
Open Barcode Generator →Related Tools & Guides
What is a barcode generator?
A barcode generator is a free online tool that takes a string of characters (a product SKU, a URL, a phone number) and renders it as a machine-readable barcode image in formats like Code 128, UPC-A, EAN-13, Code 39, ITF-14, or QR. The barcode image can be downloaded as PNG or SVG and printed on product labels, shipping boxes, inventory tags, or receipts. Toolzie's free /barcode_generator/ supports all 7 formats in your browser with no signup.
What is the difference between UPC and EAN barcodes?
UPC-A is the 12-digit barcode standard used in the United States and Canada for retail products. EAN-13 is the 13-digit international standard used in the rest of the world (and increasingly in North America for products sold globally). A UPC-A barcode is technically a valid EAN-13 with a leading zero, so any system that reads EAN-13 can read a UPC-A. For products sold only in the US/Canada, UPC-A is sufficient. For products sold internationally, EAN-13 is required. Both formats are administered by GS1 and require a paid company prefix.
How do I generate a free barcode?
Three steps. First, choose a format: Code 128 (most flexible alphanumeric), UPC-A (US/Canada retail), EAN-13 (international retail), Code 39 (older alphanumeric), ITF-14 (shipping cartons), or QR code (URLs, contact cards, large data). Second, enter your data: a product SKU, a URL, a phone number, a tracking number, or any alphanumeric string the format supports. Third, download as PNG or SVG. Toolzie's free /barcode_generator/ does this in your browser with no signup, no watermark, and no data sent to a server. The barcode image is generated entirely client-side using the JsBarcode library.
Do I need a GS1 company prefix to generate a barcode?
It depends on the use case. For internal use (warehouse inventory, library books, internal SKUs, asset tags, event tickets), no GS1 prefix is required. You can use Code 128, Code 39, or any internal coding scheme. For retail products sold to consumers in stores, yes, a GS1 company prefix is required for UPC-A, EAN-13, and EAN-8. GS1 prefixes start at $130 USD/year for a small company and can run into the thousands for larger prefixes. The barcode image can be generated for free; the right to use the number in commerce is what GS1 sells. A common mistake is to buy a 'barcode' from a reseller like eBay or a barcode shop — these numbers often duplicate or are not registered with GS1, so they fail retailer compliance checks.
What is the difference between a barcode and a QR code?
Barcodes encode data in one dimension (horizontal lines of varying widths). 1D barcodes (UPC, EAN, Code 128, Code 39) store 20-30 characters typically — perfect for product identifiers, ISBNs, and inventory tracking. QR codes are 2D — they encode data both horizontally and vertically, allowing them to store 4,000+ alphanumeric characters or 7,000+ numeric digits, plus binary data, vCards, WiFi credentials, and more. Use QR codes for URLs, contact cards, payment info, anything that needs more data than a 1D barcode holds. Use 1D barcodes for retail product identification, shipping labels, and inventory tracking where the data is short and the scanner infrastructure expects 1D.
What is an ISBN barcode and how do I create one?
An ISBN barcode is a 13-digit barcode used on the back cover of books. The first 3 digits are 978 (or 979 for new ISBNs), the next 9 digits are the unique book identifier assigned by your country's ISBN agency, and the last digit is a check digit calculated with a specific modulo-10 algorithm. To create an ISBN barcode, you can use the free EAN-13 format: enter the full 13-digit ISBN (including the 978 or 979 prefix) and the generator will produce the standard barcode. The ISBN agency assigns the 9-digit identifier; the check digit is computed automatically. Book ISBNs in Canada are assigned by Library and Archives Canada; in the US, by Bowker; in the UK, by Nielsen.
Why won't my barcode scan?
The 5 most common reasons a barcode won't scan: (1) insufficient quiet zone (the white space around the barcode must be at least 10x the width of the thinnest bar); (2) low print resolution (use 300 DPI minimum, vector PDFs for variable-size use); (3) poor color contrast (always black on white, avoid yellows, oranges, light blues, and reds); (4) the barcode is too small (the thinnest bar must be at least 0.01 inches wide / 0.25mm); (5) the data is invalid for the format (UPC-A must be exactly 12 digits, EAN-13 exactly 13, the check digit must be correct). Toolzie's /barcode_generator/ validates the data and shows a clear error message if the format rejects the input, so you catch issue (5) before you print 1,000 labels.
What is the best barcode format for inventory tracking?
For internal inventory tracking, Code 128 is the most flexible choice. It supports the full ASCII character set (128 characters: uppercase, lowercase, digits, symbols, control codes), has a high data density (about 2.5x more data per inch than Code 39), and includes a built-in checksum for error detection. Code 39 is older and only supports 43 characters (uppercase letters, digits, and a few symbols), so it's a poor choice for modern systems. For shipping cartons (where the barcode is printed on a corrugated box and may get scuffed or torn), ITF-14 is the industry standard — it has a thicker bar pattern that's more tolerant of printing imperfections. For retail POS, UPC-A or EAN-13 is required (and you need a GS1 prefix). For asset tracking, Code 128 is the standard.