A barcode is a picture of data that a scanner can read

A barcode converts information — usually a product number or inventory code — into a pattern of black and white lines or dots that a machine can recognize. When you see bars of different widths on a product package, those widths represent numbers. A barcode scanner reads the pattern, translates it back into the original number, and sends that number to a computer system. The computer then looks up what that number means: the price, the product name, where it came from, or how many units are in stock.

Creating a barcode is straightforward because the encoding rules are standardized. You do not need special equipment or software — you can generate one using free online tools, a spreadsheet formula, or design software. The hard part is not making the barcode itself; it is deciding what number to encode and making sure you use the right barcode format for your situation.

Key Takeaways

  • A barcode encodes a number into lines or dots; the scanner reads the pattern and sends the number to a computer system.
  • The most common formats are UPC (for retail products), Code 128 (for shipping and inventory), and QR codes (for URLs or contact information).
  • You can generate a barcode free using online generators, spreadsheet functions, or design software once you have the number you want to encode.
  • Retail barcodes (UPC) require a unique number from GS1, the organization that manages product codes; other formats let you use any number you choose.

The three main barcode formats and when to use each one

UPC (Universal Product Code) is what you see on grocery items and retail products. It encodes a 12-digit number. Each digit is represented by a specific pattern of bars. UPC barcodes are narrow and designed to scan quickly at checkout. If you are selling a physical product in a store or online marketplace, you need a UPC. The number itself comes from GS1, a nonprofit that assigns unique product codes to prevent conflicts — two companies cannot use the same UPC number.

Code 128 is used for shipping labels, warehouse inventory, and internal business tracking. It can encode numbers, letters, and symbols, making it flexible for different types of data. Code 128 barcodes are taller and narrower than UPC codes. You can use any number or code you want; there is no central authority assigning them. This format is common on FedEx and UPS labels, and in retail backrooms for tracking stock.

QR codes are square barcodes that encode URLs, contact information, or short text. A smartphone camera can read them without special equipment. QR codes hold much more data than linear barcodes and are useful for linking a physical item to a website, menu, or payment system. You can generate a QR code for free using any online QR generator.

How to get a UPC number if you are selling a product

If you are creating a product to sell in stores or on major online marketplaces like Amazon, you need a UPC number from GS1. You cannot make up a UPC; the number must come from an official source. GS1 is the organization that manages product codes in the United States and most countries worldwide.

To get a UPC from GS1, you register as a business, pay a one-time setup fee (which varies by the number of codes you need), and receive a unique company prefix. GS1 then assigns you a block of numbers. The cost depends on how many codes you need — a small business might pay less than a large manufacturer. Once you have your assigned numbers, you can generate the actual barcode image yourself using free tools.

Some online marketplaces like Amazon allow you to use their own internal codes instead of GS1 UPCs for private-label products, but this limits where you can sell. If you want to sell in physical retail stores, you must have a real GS1 UPC.

Using free barcode generators to create the image

Once you have the number you want to encode, you can generate the barcode image using free online tools. Websites like Barcode Monkey, TEC-IT, or ZXing allow you to enter your number, choose the format (UPC, Code 128, QR, etc.), and read the barcode as an image file. The process takes seconds.

You can also use spreadsheet software like Excel or Google Sheets. Both have built-in barcode fonts and formulas that convert a number into barcode symbols. You type the number, explore the barcode font, and the cell displays the barcode pattern. This method is useful if you need to generate many barcodes at once — you can paste a list of numbers and explore the font to the entire column.

Design software like Adobe Illustrator or Canva also includes barcode generators. If you are designing a product label or packaging, you can embed the barcode directly into your design file.

What happens when a scanner reads your barcode

A barcode scanner uses a laser or camera to read the pattern of lines or dots. It measures the width of each bar and space, translates that pattern back into the original number, and sends the number to a computer system. The computer looks up that number in a database to find the associated information.

For a retail product, the database contains the price, product name, and inventory count. For a shipping label, the database tracks the package location and delivery status. For a QR code, the scanner typically opens a web browser and navigates to the encoded URL. The barcode itself does not contain all this information — it only contains the number. The database does the actual work of matching the number to the data.

Why barcode quality matters for scanning

A barcode must be printed clearly and at the right size to scan reliably. If the lines are too thin, blurry, or damaged, a scanner may not read it. If the barcode is too small, the scanner cannot distinguish the individual bars. Most retail barcodes have a minimum size requirement — usually at least half an inch wide.

The contrast between the black bars and white background also matters. A barcode printed in dark gray on light gray may not scan, even though it looks fine to the human eye. For this reason, barcodes are almost always black on white or white on black. If you are printing barcodes on product labels or packaging, test them with an actual scanner before you print thousands of copies.

When you read a barcode image from a generator, it is usually a vector file (like PDF or SVG) or a high-resolution image (like PNG). These formats preserve the sharp edges of the bars when you resize them. Avoid converting barcodes to low-resolution formats like JPG, which can blur the lines and cause scanning failures.

The difference between 1D and 2D barcodes

1D barcodes (one-dimensional) are the traditional linear barcodes made of vertical lines. UPC and Code 128 are 1D formats. They encode data horizontally — the width and spacing of the bars represent the digits. 1D barcodes are straightforward, fast to scan, and work with basic laser scanners. They hold less data than 2D codes, typically 20 to 30 characters.

2D barcodes like QR codes encode data both horizontally and vertically, using a grid of squares or dots. They hold much more data — a QR code can store thousands of characters. They also have built-in error correction, so a QR code can still be read even if part of it is damaged or obscured. The trade-off is that 2D codes require a camera or smartphone to read; older laser scanners cannot read them.

Frequently Asked Questions

Can I use any number in a barcode, or does it have to be registered?

It depends on the format. For UPC barcodes on retail products, the number must come from GS1 — you cannot use a random number. For Code 128, QR codes, and other formats, you can use any number or text you want. If you are only using the barcode internally (for inventory or shipping), you have complete freedom to choose the number.

What is the difference between a barcode and a SKU?

A SKU (stock keeping unit) is a number that a business assigns to track inventory internally. A barcode is the visual representation of a number that a scanner can read. A product can have both a UPC (the retail barcode) and a SKU (the internal tracking number). They are often different numbers.

Do I need special equipment to scan a barcode?

For 1D barcodes like UPC and Code 128, you need a barcode scanner — a handheld device or a fixed scanner at a checkout counter. For QR codes, any smartphone camera works. You do not need to buy special equipment for QR codes; most phones can read them natively.

Can I print barcodes at home?

Yes, you can print barcodes on a regular inkjet or laser printer. Make sure the printer produces sharp, clear lines and that you use good-quality paper or label stock. Test the printed barcode with a scanner before using it on products. If the barcode does not scan, the resolution or contrast may be too low.

What happens if two products have the same barcode?

If two different products share the same UPC, the scanner will always return the same product information, regardless of which item you are actually scanning. This causes inventory and pricing errors. This is why GS1 manages UPC assignment — to prevent duplicate numbers. Using a barcode generator with a number you made up will not cause conflicts unless you happen to guess a real UPC, which is extremely unlikely.