How to make a barcode
A barcode encodes digits or text as bars a scanner can read. This guide explains which type to choose for inventory labels or retail products, how the check digit is calculated, and how to print a code that scans reliably.
The short version
- Choose the type: Code 128 for your own labels, EAN-13 or UPC-A for retail products.
- Enter the data. Text for Code 128; 12 digits for EAN-13 or 11 for UPC-A.
- Check the result including the calculated check digit.
- Download and print as SVG for sharp print, then test-scan it.
Skip the arithmetic. The free Barcode Generator does this for you, shows the formula and the working with your own numbers, and runs in your browser - nothing you type is uploaded. Also useful: Case Converter.
Which barcode for which job
| Type | Encodes | Use for |
|---|---|---|
| Code 128 | Letters, digits and symbols | Inventory, asset tags, order and shipping references |
| EAN-13 | 13 digits | Retail products outside the US and Canada |
| UPC-A | 12 digits | Retail products in the US and Canada |
Retail numbers must come from GS1, the organisation that issues company prefixes. You cannot invent EAN or UPC numbers for products you sell through retailers or marketplaces. For your own stock and internal labels, Code 128 needs no registration.
How the check digit works
The last digit of an EAN-13 is calculated from the first 12 so a scanner can detect misreads. Multiply the digits alternately by 1 and 3 from the left, add them, and the check digit is whatever brings the total up to the next multiple of 10.
Printing so it scans
- Keep the quiet zone, the blank margin on each side. It is part of the symbol.
- Dark bars on a light background. Black on white is safest; red bars can be invisible to some scanners.
- Do not squash it. Scale width and height together, and use SVG or a large PNG for print.
- Test before you print a batch. Scan a sample with the scanner or phone app you will use.
Barcode or QR code?
A barcode (1D) holds a short code that a database looks up, such as a product or order number. A QR code (2D) can hold a web address or much more text and works from many angles. Use a barcode for inventory and retail scanners and a QR code for links.