Printed a code and need to change the link? QR Gen makes codes you can edit later.Edit codes after printing with QR Gen.See QR Gen

Open on your phone

Barcodes explained: types, numbers and how to get one

Types of barcodes in plain words: EAN-13, UPC-A, Code 128, Code 39, ITF-14 and QR. See which fits your shelf, stock or carton and who issues the number.

Most types of barcodes you will meet outside a warehouse come down to four. Shops scan EAN-13 in India and UPC-A in North America. Your own stock and shipping labels usually use Code 128. Outer cartons use ITF-14. QR codes and Data Matrix are the 2D family, and they hold far more. What decides whether a code works at a shop counter is rarely the type. It is whether the number inside it was issued to you.

That second point trips up more people than the first, so this guide covers both: what each code is, and who is allowed to hand you the digits. Every code below can be drawn with our free barcode maker, which adds the check digit and exports PNG or SVG.

Two families: lines and squares

A 1D barcode is a row of bars and gaps. A scanner sweeps a line of light across it, measures the widths and turns them into characters. Everything on the code sits along one axis, which is why 1D codes are wide and short, and why they hold only a short string.

A 2D code spreads its data over a grid. A camera reads the whole picture at once, so the code can be small, square and read from any angle. QR code is the one you know, and its limits are generous: Denso Wave, the company behind it, lists maximums of 7,089 numerals, 4,296 alphanumeric characters or 2,953 bytes for the largest symbol, against 12 digits plus a check digit in an EAN-13.

Size on paper tells the same story. We drew an EAN-13 for 5901234123457 with the JsBarcode library that powers our maker (version 3.12.3), and the bars come to 95 modules across. An EAN-8 is 67. The same 13 digits as a QR code come out as version 1, a 21 by 21 grid. That is fewer modules than the bars, but it needs a camera to read, where the bars can be read by a simple laser.

1D (lines) 2D (squares)
Reads with Laser or camera, along one line Camera or imager, whole picture
Typical content A number or short ID A link, text, a contact, long data
Examples EAN-13, UPC-A, EAN-8, Code 128, Code 39, ITF-14 QR code, Data Matrix
Where you see it Shelf labels, price tags, cartons Packaging, posters, tickets, payments

The six codes our barcode maker draws

Each of these has a job, and the job is mostly about who controls the number.

Code What it holds Where the number comes from Typical use
EAN-13 12 digits plus a check digit GS1 (GS1 India in India) Products sold in shops, most of the world
UPC-A 11 digits plus a check digit GS1 (the US and Canada office) Products sold in North America
EAN-8 7 digits plus a check digit GS1 Small packs with no room for 13 digits
Code 128 Letters, digits and symbols You Stock labels, shipping and parcel labels
Code 39 Capitals, digits, space and - . $ / + % You Asset tags, ID badges, older systems
ITF-14 13 digits plus a check digit GS1, derived from a product number Outer cartons of retail goods

EAN-13, UPC-A and EAN-8 are retail codes. A till somewhere will look the number up, so the digits must be unique in the world. Code 128 and Code 39 are internal codes: only your systems read them, so you invent the content. ITF-14 sits between the two, because its number is built from a retail number you already own.

Two of these deserve a closer look because people choose between them constantly. EAN-13 vs UPC-A is a question of region, and the two turn out to be the same symbol with one extra digit. Code 128 vs Code 39 is a question of space and character set, and we measured how much space.

Retail codes and internal codes are different animals

Suppose you make pickles and sell them in a supermarket. The buyer’s system wants to know which jar this is, and it keys its records to a Global Trade Item Number, a GTIN. Another maker’s jar must never share your number. Someone has to hand out the numbers so that never happens, and that someone is GS1, through national offices.

Now suppose you run a workshop and want to tag 300 tool crates. Nobody outside your building scans them. CRATE-0042 is as good a value as any, and no one needs to approve it. Code 128 does this well because it takes letters and symbols as well as digits.

Mixing the two up causes the classic mistake: printing a retail-looking 13-digit barcode with a number from a free generator and then discovering that a marketplace or retailer rejects it. The shape of the barcode is fine. The digits belong to nobody, or worse, to somebody else. The India-specific version of that story, and how to avoid it, is in how to get a barcode for your product in India.

How a 13-digit number is built

A retail number has three parts. A prefix identifies the company that was issued the number, an item reference identifies one product of that company, and the last digit is a check digit. In India, GS1 India’s own page says the numbers begin with 890 and that only GS1 India is authorised to issue them, usually as 13-digit GTINs printed as EAN-13. The same page says you need one unique GTIN for every SKU and every variant, a different size, flavour or pack each getting its own.

The check digit is the part you can compute yourself, and it explains what a barcode maker can and cannot tell you. GS1 UK describes the method in five steps: add every alternate digit starting from the right, multiply that by 3, add the remaining digits, then take the smallest number that brings the total to a multiple of 10.

Here it is for the 12 digits 590123412345, the sample our EAN-13 maker shows:

Digits from the right:   5 4 3 2 1 4 3 2 1 0 9 5
Alternate digits (1st, 3rd, 5th...):  5 + 3 + 1 + 3 + 1 + 9 = 22
22 x 3 = 66
Other digits:            4 + 2 + 4 + 2 + 0 + 5 = 17
66 + 17 = 83
Next multiple of 10 is 90, so the check digit is 7
Full number:             5901234123457

If you type 13 digits into our maker and the last one is wrong, it tells you the check digit does not match. If you type 12, it works the last one out. That is all a check digit proves: the digits were typed correctly. It says nothing about who owns them, and that gap is the whole subject of the India guide above.

Seagull Scientific’s symbology notes add a detail worth knowing: the first digit of an EAN-13 is not drawn as bars of its own. It is encoded in the parity pattern of the left half of the symbol. It also explains why a UPC-A becomes an EAN-13 by adding a zero in front: the zero only changes the parity pattern, not the bars.

Internal codes handle checking differently. Code 128 builds a check character into every symbol, and Code 39’s is optional. We measured what that costs in width in the Code 128 vs Code 39 comparison.

Inside an EAN-13: 95 modules

Open one up and the structure is tidy. Seagull’s notes describe it as a start guard, six data characters, a centre guard, six more characters including the check digit, and a stop guard. We split the bars our maker produced for 5901234123457 and counted the modules in each part:

Left guard     3 modules   (bar, space, bar)
Left half     42 modules   (6 digits x 7 modules)
Centre guard   5 modules
Right half    42 modules   (6 digits x 7 modules, check digit last)
Right guard    3 modules
Total         95 modules

Inside an EAN-13: 95 modules

3Left half, 42 modulesLeft, 425Right half, 42 modulesRight, 423 5901234123457
  • 5The first digit has no bars. The scanner works it out from the left half's pattern.
  • 7The check digit, last on the right, proves the other twelve were typed correctly.
Bars generated for 5901234123457, the sample our barcode maker shows. 3 + 42 + 5 + 42 + 3 = 95 modules.

Notice that only 12 digits are drawn. The first digit, 5 in this number, is not given any bars. The scanner works it out from the pattern of the left half. That is the trick that lets a 13-digit number fit into the same 95 modules as a 12-digit UPC-A.

It also tells you why shrinking a barcode has a floor. At the 95 modules above, a code printed 30 mm wide would have bars about 0.3 mm each, and the narrowest line must still be wider than your printer’s dot. A cheap thermal printer at low resolution can blur one-module bars into their neighbours, and then the scanner reads a different digit, or none.

Other types you may see on packs and parcels

You will meet a few more names, and most of them are variations on what is above.

GS1-128 is Code 128 with a fixed structure for extra data such as batch numbers and expiry dates. GS1 India points to it, along with ITF-14, for shipping cartons and pallets. GS1 DataBar is a slimmer linear code that GS1’s retail guideline lists next to EAN and UPC. Data Matrix is a 2D square; GS1 India says the GS1 version, used in healthcare, can hold up to 2,335 alphanumeric characters. PDF417 is the stacked-line 2D code on boarding passes and driving licences.

You can generate none of the four in our barcode maker, and a small shop rarely needs any. If a buyer asks for one, they will say so in their packaging specification, and it will usually come with its own GS1 rules about what the data must contain.

Which type for which job

Match the code to the job, not to what looks familiar.

  • A product on a shop shelf in India: EAN-13, with a number from GS1 India.
  • A product you will sell in the US or Canada: UPC-A, or an EAN-13 if the retailer accepts it. Ask the buyer which, because the answer depends on the destination.
  • A tiny pack, such as a lip balm or a sachet: EAN-8, only when there is truly no room for the longer code.
  • Your own SKUs, bins, parcels and returns: Code 128. It packs digits tightly and takes full upper and lower case.
  • Something that has to work with an old system or a standard that names Code 39: Code 39. Otherwise skip it.
  • The brown outer carton holding 12 or 24 retail packs: ITF-14. GS1 India’s guidance names ITF-14 and GS1-128 for shipping cartons and pallets.
  • Anything that should open a web page or hold more than a number: a QR code, which is not a replacement for the shelf barcode yet. See the next section.

ITF-14 has a number structure of its own. In our maker’s sample, 15400141288763, the leading 1 marks the packaging level and the last digit, 3, is a check digit worked out the same way as above. You type 13 digits and the maker adds the 14th.

How to get a number you are allowed to use

For an internal code, you do not need to get anything. Pick a format, such as CRATE-0042, and keep a list so you never reuse one.

For a retail code, you apply. In India that means GS1 India: you register your company, choose how many barcodes you want and for how many years, send identity and business documents, and wait for the numbers to be allotted. GS1 India says allotment is usually 7 to 10 working days after it has the form, documents and payment. Fees depend on your annual turnover, the number of barcodes and the subscription period, so they are worked out on GS1 India’s own calculator rather than a price list. We walk through the documents, the order of steps and the marketplace angle in how to get a barcode for your product in India.

Once the numbers arrive, the barcode image is the easy part. Put the 12 digits into the barcode maker, pick EAN-13, and download the file.

Where 2D codes fit in a shop

QR codes already sit on many packs, but they usually lead to a web page. The till does not read them. That is changing, slowly and on a schedule.

GS1’s retail guideline states the initial goal plainly: point-of-sale scanning should be able to read and process the GTIN from both existing linear and 2D barcodes by the end of 2027, which is the “Sunrise 2027” you may have seen. The same guideline says linear barcodes such as EAN and UPC will not go away and will coexist with 2D codes for as long as they are useful. In plain terms: keep your EAN-13, and if you add a QR code, make sure it carries your GTIN in the GS1 format instead of a bare web address.

That is a different thing from the QR code on a poster. We compare them properly in QR code vs barcode, including capacity, damage tolerance and what a shop actually does with each. If you want to see what is inside a QR code, how QR codes work takes a real one apart.

Mistakes that cost a print run

Most barcode disasters are boring and avoidable.

  1. Using a generator’s random 13 digits on a retail pack. The check digit will pass, because any digits can be given a correct one. Look at 8901234567890: we made it up, and it satisfies the check-digit rule with 0 as the last digit. It looks like an Indian GS1 number and it is not one. We have no idea whose product it might collide with, which is the point.
  2. One barcode for three flavours. Each flavour, size and pack needs its own GTIN, so one barcode shared across variants leaves the shop unable to tell them apart in its stock and sales records.
  3. Losing the leading zero. A spreadsheet cell formatted as a number drops it, and a UPC-A or an EAN-13 starting with 0 turns into a different, shorter number. Format the column as text before you paste digits in.
  4. Writing lower case into Code 39. The standard set has capital letters only, and our maker converts what you type to capitals. If the case matters to your system, use Code 128.
  5. Printing before testing. Print one sheet, scan it with the real scanner, and only then run the batch.

Make it scan the first time

A few habits prevent most failures, and none of them needs special equipment.

  1. Dark bars on a light background. Black on white is the safe default. Do not invert the colours or print pale bars on a coloured pack; many scanners expect dark bars on light.
  2. Leave blank space at both ends. The empty margin beside the bars is part of the code. Do not crop it away or let artwork touch it.
  3. Scale the whole code evenly. Making the bars taller is fine. Making the whole code narrower makes every bar thinner, until the thinnest is finer than your printer can draw cleanly. Our maker has separate sliders for bar height and bar thickness, so you can change one without touching the other.
  4. Send a vector file to the printer. An SVG stays sharp at any size, while a small PNG blurs when enlarged. Our maker exports both.
  5. Test a printed copy with the scanner you will use. A screen preview proves the number, not the print.

The maker draws one code at a time. If you need a hundred QR labels from a sheet, that is what QR Gen Pro’s bulk mode is for (up to 100 codes, with A4 print sheets). For everything in the table above, the free barcode maker is enough.

What to print

If you are choosing right now, this is the short answer by situation:

  • Selling in Indian shops or on Amazon: register with GS1 India, then make an EAN-13 from your numbers.
  • Labelling your own stock or shipments: Code 128, any text you like.
  • Boxing retail packs for transport: ITF-14.
  • Wanting a link, a menu or a payment: a QR code from our generator, not a barcode.

Ready to try it? Free, no sign-up, made in your browser.

Open the barcode maker