Four barcodes, four different jobs
The generator above produces the four linear (one-dimensional) barcodes that cover almost every retail and warehouse need. They are not interchangeable — each is defined by a different standard and read by different systems.
| Symbology | Encodes | Typical use | Standard |
|---|---|---|---|
| EAN-13 | 13 digits | Consumer products sold anywhere outside North America, and increasingly inside it | ISO/IEC 15420, GS1 |
| UPC-A | 12 digits | Consumer products in the US and Canada | ISO/IEC 15420, GS1 |
| EAN-8 | 8 digits | Very small packs with no room for EAN-13 — gum, cosmetics, small tubes | ISO/IEC 15420, GS1 |
| Code 128 | Letters, digits, punctuation | Internal SKUs, inventory, asset tags, shipping and library labels | ISO/IEC 15417 |
A rough rule: if the barcode will be scanned at a shop checkout, it must be EAN-13, UPC-A or EAN-8 carrying a number you are entitled to use. If it will only ever be scanned inside your own business, Code 128 is almost always the better choice because it can hold your existing SKU format, letters included.
The number matters more than the bars
Generating the bars is the easy part. A retail barcode is only valid if the number in it is a GTIN (Global Trade Item Number) issued under your company's GS1 prefix. Retailers and marketplaces check this: a made-up EAN-13 may scan perfectly and still be rejected by a supermarket's listing system or flagged by Amazon's GTIN validation, and it may collide with a real product somewhere else in the world.
So the order of operations for a product going into retail is:
- Join your national GS1 organisation and receive a company prefix (or, for a handful of products, buy individual GTINs directly from GS1 where that is offered).
- Assign a GTIN to each product variant — each size, colour and pack count needs its own number.
- Generate the barcode for each number. This is where a tool like this one comes in, and it is free.
Codes sold cheaply by resellers outside GS1 are a known source of rejected listings. If a retailer will see your product, get the numbers from the source.
For internal use — stock rooms, tool cribs, equipment tags, event badges — none of this applies. Encode whatever your system uses.
How the check digit is calculated
EAN-13, UPC-A and EAN-8 all end in a check digit that lets the scanner detect a misread. Enter the number without it and the generator calculates it; enter the full number and the generator verifies it, telling you the correct digit if yours is wrong.
The calculation is the GS1 mod-10 algorithm. Taking 400638133393 as an example:
- Starting from the rightmost digit, multiply the digits alternately by 3 and 1: 3×3, 9×1, 3×3, 3×1, 3×3, 1×1, 8×3, 3×1, 6×3, 0×1, 0×3, 4×1.
- Add the results: 9 + 9 + 9 + 3 + 9 + 1 + 24 + 3 + 18 + 0 + 0 + 4 = 89.
- The check digit is whatever brings that total up to the next multiple of 10: 90 − 89 = 1.
The full EAN-13 is 4006381333931. The same arithmetic works for UPC-A, EAN-8, ITF-14 and GTIN-14, which is why the number can move between them by adding or removing leading zeros: UPC-A 036000291452 is the same product as EAN-13 0036000291452.
Code 128 has its own check character too — a weighted sum of every symbol, modulo 103 — but it is never printed as text. The generator adds it to the bars automatically.
What the generator does with Code 128
Code 128 has three internal character sets. Set B covers printable ASCII; set C packs two digits into each symbol, halving the width of numeric runs. The generator switches between them using the minimum-length rules in the GS1 General Specifications: it starts in set C for data beginning with four or more digits, and switches to C for a run of six or more digits mid-message (four or more at the end).
The practical effect is that SKU-1234567890 produces a noticeably narrower barcode than a naive encoder would, which matters on small labels. A narrower symbol at the same bar width is easier to fit; at the same overall width it has thicker bars, which scan more reliably.
One limitation: this tool produces plain Code 128. GS1-128 — the variant used on logistics labels, with application identifiers like (01) for GTIN and (17) for expiry date — needs a special FNC1 character and is best produced by your shipping or labelling software.
Printing size: the X-dimension
Barcode size is governed by the X-dimension, the width of the narrowest bar. At the GS1 nominal size (100% magnification), an EAN-13 has an X-dimension of 0.33 mm and the full symbol, including quiet zones and digits, is about 37.3 mm wide by 25.9 mm tall.
GS1 permits retail barcodes from 80% to 200% of nominal size. Go smaller and older scanners start to fail; go larger and you waste packaging space for no benefit. Two practical rules:
- Never shorten the bars to fit. Truncating the height — a common trick to squeeze a barcode onto a narrow label — makes the symbol much harder to scan at an angle and is not allowed by the retail specification.
- Scale proportionally. Stretch the width without the height, or vice versa, and you change the ratio between bars and spaces. Use the SVG file and resize it with the aspect ratio locked.
The SVG download is resolution-independent, so it stays sharp at any magnification. If you need a PNG, export at a size where each module is a whole number of printer dots, which the 4× PNG export is designed for.
Quiet zones: the margins are part of the barcode
Every linear barcode needs blank space on each side so the scanner can tell where the symbol begins. An EAN-13 needs 11 modules on the left and 7 on the right; UPC-A needs 9 on each side; Code 128 needs at least 10. The downloads include these margins.
The most common cause of a barcode that will not scan at the checkout is a designer placing it too close to a box edge, a fold, or other artwork. Leave the white space alone.
Colour: what a laser scanner can see
Most checkout scanners illuminate the barcode with red light, around 630–670 nm. Under red light, red, orange, pink and yellow all look much like white. A barcode printed in red bars is invisible to the scanner; one printed on a red background is fine.
- Bars: black, dark blue, dark green or dark brown.
- Background: white, or light yellow, orange or red.
- Avoid: red, orange or yellow bars; metallic and reflective inks; printing on clear film over a dark product.
The generator warns you when the contrast is too low, but cannot judge how a colour behaves under red light — when in doubt, use black on white.
Frequently asked questions
Can I use these barcodes on products I sell in shops?
The barcode images, yes — they are standard EAN-13, UPC-A and EAN-8 symbols. The numbers inside them must be GTINs you are licensed to use, which in practice means numbers issued by GS1 to your company. A barcode with an invented number may scan but be rejected by the retailer.
What is the difference between EAN-13 and UPC-A?
A UPC-A is effectively an EAN-13 whose first digit is zero. Modern scanners worldwide read both. North American retailers have historically used UPC-A; most of the rest of the world uses EAN-13. If you are unsure, ask your retailer which they expect.
Why does the generator say my check digit is wrong?
The final digit of an EAN or UPC is calculated from the others, so a typo anywhere in the number produces a different check digit. Re-enter the number without its last digit and the generator will calculate the correct one — then double-check the rest of the number against your GS1 records.
Which barcode should I use for inventory?
Code 128. It encodes letters, digits and punctuation, so it can hold your existing SKU or asset number exactly, and its digit-pair compression keeps numeric codes compact. Every modern handheld scanner reads it.
Can I make a barcode for Amazon?
Amazon requires GTINs that match the GS1 database for most categories, so you need GS1-issued numbers. Once you have them, you can generate the EAN-13 or UPC-A here. For Amazon's own FNSKU labels, print them from Seller Central, which formats them as Code 128 for you.
Should I use a barcode or a QR code?
Use a linear barcode where a checkout or warehouse scanner will read it, because many still read only 1D symbols. Use a QR code when a customer will scan with their phone, or when you need to carry a URL or more than a short number. The two are moving closer: retailers are rolling out 2D-capable scanners that read QR codes with GS1 Digital Link.
Is my product number sent anywhere?
No. The barcode is calculated and drawn by JavaScript in your browser. Nothing you type is transmitted, which also means the generator works offline once the page has loaded.