What each format is for
The abcsyg.com Barcode Generator offers five formats. The main difference is not how they look but which characters they accept and who has to give you the number.
| Format | What it holds | Typical use |
|---|---|---|
| EAN-13 | 13 digits (12 data plus 1 check) | Retail products in most of the world |
| UPC-A | 12 digits (11 data plus 1 check) | Retail products in the United States and Canada |
| EAN-8 | 8 digits (7 data plus 1 check) | Very small packages that cannot fit an EAN-13 |
| Code 128 | Letters without accents, numbers and keyboard symbols | Logistics, shipping, inventory, ID badges |
| Code 39 | Capital letters, numbers and - . $ / + % and the space | Older format used in industry; almost every scanner reads it |
As a rule of thumb, if the code identifies a product that is sold in stores, use EAN-13 or UPC-A. For anything else (boxes, shelves, employee records, equipment, orders) Code 128 is the most convenient option because it takes text and numbers and does not depend on any organization.
How the EAN-13 check digit is calculated
The last digit of an EAN-13 is not data: it is a verification computed from the other twelve. It catches typing and printing mistakes. Here is how it works, using the twelve digits 400638133393 as an example.
- Write the twelve digits and give them alternating weights, starting from the left with 1 and then 3: 1, 3, 1, 3, 1, 3, 1, 3, 1, 3, 1, 3.
- Multiply each digit by its weight: 4×1 = 4, 0×3 = 0, 0×1 = 0, 6×3 = 18, 3×1 = 3, 8×3 = 24, 1×1 = 1, 3×3 = 9, 3×1 = 3, 3×3 = 9, 9×1 = 9, 3×3 = 9.
- Add everything: 4 + 0 + 0 + 18 + 3 + 24 + 1 + 9 + 3 + 9 + 9 + 9 = 89.
- Find how much is missing to reach the next multiple of 10: from 89 to 90 is 1. That is the check digit.
- The full code is 4006381333931. If the sum were already a multiple of 10, the check digit would be 0.
If you change a single digit and leave the last one as it was, the math no longer works and the scanner rejects the read instead of delivering a wrong number. That is why the generator, when you type all 13 digits and the last one does not match, tells you what it should be; and if you type only the first 12, it calculates the digit and adds it for you.
UPC-A and EAN-8: same calculation, different length
UPC-A uses the same idea with 11 data digits. Example: 03600029145. The digits in odd positions (1st, 3rd, 5th…) add up to 0 + 6 + 0 + 2 + 1 + 5 = 14, which is multiplied by 3: 42. The digits in even positions add up to 3 + 0 + 0 + 9 + 4 = 16. Total: 42 + 16 = 58, and to reach 60 you need 2. The full code is 036000291452.
A UPC-A is equivalent to an EAN-13 that starts with 0: the same number with a zero in front gives 0036000291452 and the same check digit. That is why modern scanners understand both.
In EAN-8 the weights alternate the other way (3, 1, 3, 1, 3, 1, 3, starting from the left). For 7351353: 21 + 3 + 15 + 1 + 9 + 5 + 9 = 63, and up to 70 you need 7. The code is 73513537.
The important warning: GS1 assigns the numbers
Generating a bar drawing from a number does not give you the right to use that number. To sell products in stores or on online marketplaces that require it, EAN and UPC numbers must be assigned to your company through GS1, the organization that administers these codes, usually through its office in your country. GS1 reserves the codes per company so that two manufacturers do not end up with the same number.
The generator draws the symbol correctly, but it does not know whether the number you typed already belongs to another product, and it does not register anything. If you make up an EAN-13 and put it on a product you plan to sell, it may collide with another brand's code and cause confusion in the inventory of whoever buys it.
Internal use is a different story: your own inventory, shelves, boxes, employee records, equipment or event tickets. There you can use Code 128 with any codes you want, or even a made-up EAN-13, as long as the code never leaves your organization.
Size, contrast and quiet zones
Most barcodes that fail to scan fail because of how they were printed, not because of the number. Check these points before printing:
- Contrast: black bars on a white background is the safe combination. Avoid light-colored bars, textured backgrounds and red on white, which many red-light scanners cannot distinguish.
- Quiet zone: leave blank space on both sides. For EAN-13 the standard asks for about 11 modules on the left and 7 on the right, where a module is the width of the thinnest bar. If the code touches the edge of the label or a drawing, the scanner cannot tell where it starts.
- Bar width: in the generator, use a width of 2 px or more. The thinner the bars, the easier it is for a low-resolution printer to smear them together.
- Height: very short bars are harder to aim at. The default is usually enough; raise it if the scanner has to be aimed by hand.
- Do not stretch it: if you enlarge or shrink a PNG with different proportions, the bars change their relative width and the code stops reading.
- Show the text below: it is worth leaving it on, because if the code gets damaged someone can type the number in.
PNG or SVG: when to use each
The generator lets you download the code as PNG or SVG. PNG is a pixel image: it is the practical option for pasting into a document, a spreadsheet or a fixed-size label. If you enlarge it afterwards, the bar edges look blurry and it may be hard to read.
SVG is a vector drawing: it scales to any size without losing sharpness, which makes it the best choice for print shops, packaging design or large signs. If you are not sure, download both: the PNG for everyday use and the SVG as a backup original.
Test it before printing 500 labels
Show the code on screen (or print a single test sheet) and scan it with your phone camera or with whatever code reader app you use. Check that the number it reads is exactly the one you typed.
Do it also at the real size the code will have on the label, and with the same paper and printer. A code that reads fine on screen can fail on a low-quality thermal printer or on glossy paper. If it fails, try wider bars, more margin or a whiter background before changing format.
Frequently asked questions
Can I make up an EAN-13 to sell my products?
To sell them in stores or on platforms that require it, you need the numbers GS1 assigns to your company. A made-up number may match another product's. For internal inventory you can use any codes you like.
What is the difference between EAN-13 and UPC-A?
EAN-13 has 13 digits and is the standard in most of the world; UPC-A has 12 and is used in the United States and Canada. A UPC-A is the same as an EAN-13 that starts with 0, and modern scanners read both.
Which format should I use for my own inventory?
Code 128: it accepts letters without accents, numbers and keyboard symbols, it is compact, and it does not require registering numbers with any organization.
Why is my EAN-13 not valid?
Most likely the last digit does not match the calculation from the other twelve. The generator shows what it should be, or calculates it for you if you type only the first 12 digits.
Is the number I type uploaded to a server?
No. The barcode is drawn in your browser and nothing is sent to any server.