What the numbers on a barcode mean

Short answer: three fields and a checksum. And the part everybody gets wrong — the leading digits say who issued the number, not where the thing was made.

5 min read · last checked 2026-09-08

Advertisement

A barcode is a number written so a scanner can read it, and the number is not arbitrary. An EAN-13 — the thirteen-digit code on almost everything sold in Europe, Asia and Latin America — is three fields joined together, with a checksum on the end.

The thirteen digits of an EAN-13 split into three coloured fields. The first three digits are the GS1 prefix, identifying which organisation issued the number. The middle nine are the company and product together, with a split that varies. The final digit is a check digit calculated from the twelve before it.
Three fields and a checksum. Only the last one can be worked out by looking at the others — the boundary between company and product cannot be found by eye at all.
The tool Barcode Generator EAN-13, UPC-A, EAN-8 and Code 128, with the check digit worked out and a warning when yours is wrong.

The prefix is not a country of origin

This is the one worth knowing, because a whole genre of phone app is built on getting it wrong. GS1 answers it themselves, in one line: “the GS1 Prefix does not show the country of origin”.

The first digits identify the GS1 member organisation that issued the company its number. Those organisations are mostly national, which is why the prefix looks like a country code and why it gets reported as one. It is not one.

A company registered in one country routinely sells products manufactured in another — that is what most consumer goods are. The prefix tells you where the number came from. It says nothing whatsoever about where the factory is, what is in the box, or who owns the brand today.

Two prefixes are genuinely informative rather than national. 978 and 979 mean the item is a book: the rest of the number is its ISBN. 977 means a periodical, carrying an ISSN. And 200 to 299 is reserved for shops to use internally — the number a supermarket prints on a bag of loose apples it weighed itself. Those never leave the shop, which is why two different shops can use the same one.

Where the company ends and the product begins

You cannot tell by looking, and this surprises people.

GS1 issues company prefixes of different lengths — a firm expecting to number a handful of products gets a long prefix and few digits left for items; a firm numbering tens of thousands gets a short one. So in the middle nine digits, the split between "which company" and "which product" is different for every company, and there is no marker in the number saying where it falls.

Which also means the number is not a description. Nothing in it encodes the price, the weight, the colour or the flavour. It is a key. Everything else lives in a database somewhere, which is why the same barcode scans as different prices in two different shops.

One consequence that catches new sellers: every variant needs its own number. A 500-gram bag and a 1-kilogram bag of the same coffee are two different trade items and take two different codes. So do two colours of the same shirt.

How the check digit works

The last digit is not chosen. It is calculated from the twelve before it, so a scanner can verify its own read rather than trusting it.

Take the digits from the left and multiply them alternately by one and by three. Add the results. The check digit is whatever gets that total up to the next multiple of ten. Working it through for 590123412345:

  • Digits in the odd positions — 5, 0, 2, 4, 2, 4 — add up to 17.
  • Digits in the even positions — 9, 1, 3, 1, 3, 5 — add up to 22, and multiplied by three that is 66.
  • 17 + 66 = 83. The next multiple of ten is 90, so the check digit is 7.

The whole code is 5901234123457. A scanner redoes this on every read, and a code that fails is rejected rather than guessed at — which is why a barcode printed with the wrong last digit does not scan at all, despite looking perfect. The generator here calculates it for you, and tells you when a number you paste in has the wrong one.

UPC-A, EAN-8, and the rest

UPC-A is the twelve-digit version used in the United States and Canada. It is the same system: put a zero in front of a UPC-A and you have a valid EAN-13, and the bars are identical. A European scanner reading an American product is doing exactly that.

EAN-8 is the short one, for packets with no room for a full code — chewing gum, small cosmetics. Fewer digits means fewer available numbers, so they are rationed.

Code 128 is a different animal: it carries letters as well as digits, belongs to nobody, and needs no registration. If you are labelling your own stock, equipment or shelves, that is the one you want, and you can start this afternoon.

Can you invent a number?

You can draw one, and it will scan. Whether you should depends entirely on what it is for.

For a packaging mock-up, a photograph, a film prop or a test of your own scanner, an invented number is completely fine and nobody is harmed. For a product going on a shelf it is not: the number may already belong to somebody else's item, and a retailer's system will treat it as that item — wrong price, wrong stock, wrong product on the receipt. Numbers for real retail come from GS1, and they are not free.

The in-store range, 200 to 299, exists for exactly the internal case, and using it inside your own shop or warehouse is what it is there for.

Barcodes and QR codes are not the same idea

A barcode holds a key that means something to a database. A QR code holds the data itself — a whole web address, a Wi-Fi password, a contact card — which is why one is a few centimetres of stripes and the other is a grid. If what you want is for a phone camera to do something, you want a QR code, and our guide to what is inside one covers what that means for safety.

Advertisement
Advertisement

Common questions

What do the numbers on a barcode mean?

An EAN-13 is three fields and a checksum: the first digits identify the GS1 organisation that issued the number, the middle digits identify the company and the product together, and the last digit is calculated from the others so a scanner can verify its own read. Nothing in the number encodes price, weight or colour — it is a key to a database.

Does the barcode tell you which country a product is from?

No, and this is the commonest misconception about them. The leading digits identify the GS1 member organisation that issued the company its number. Those organisations are mostly national, which is why the prefix looks like a country code — but a company registered in one country routinely sells goods manufactured in another. It says where the number came from, not where the factory is.

How is the barcode check digit calculated?

Multiply the digits alternately by one and three from the left, add the results, and the check digit is whatever brings the total to the next multiple of ten. For 590123412345 that is 17 plus 66, which is 83, so the check digit is 7 and the full code is 5901234123457.

Can I make up my own barcode number?

It will draw and scan, which makes it fine for a mock-up, a photograph or testing your own scanner. It is not fine for a product going on sale: the number may already belong to somebody else’s item and a retailer’s system will treat it as that item. Real retail numbers are issued by GS1. The 200–299 range is reserved for internal shop use.

Why does the same product have different barcodes in different sizes?

Because the number identifies a specific trade item, not a brand or a recipe. A 500-gram bag and a 1-kilogram bag of the same coffee are two different items and take two different numbers, as do two colours of the same shirt.

What is the difference between a barcode and a QR code?

A barcode holds a short key that means something to a database — the price lives in the shop’s system, not in the stripes. A QR code holds the data itself, which is why it can carry a whole web address or a Wi-Fi password, and why it needs a grid rather than a row of lines.

More guides

What is a HEIC file, and why will your PC not open it?

Half the size of a JPG, and a patent licence is why Windows refuses it.

How to get a PDF under an upload limit

Most PDFs cannot be compressed at all. Ten seconds tells you which kind you have.

Why WhatsApp ruins your photos, and how to send one properly

It re-compresses every picture you send. There is one way around it, and it is not the quality setting.

JPG or PNG: which should you use?

Photographs, JPG. Hard edges or transparency, PNG. The reason is worth two minutes.

How to get a photo under a KB limit

The quality slider is the wrong first move. Pixels are the lever that works.

Are QR codes safe? What is actually inside one

Nothing inside one can run. The risks are the destination, the sticker over the original, and who owns the code.

Why video files are so big, and what actually shrinks them

Bitrate times length is the file size. Everything else follows from that.

MP3, WAV or M4A: which audio format, and at what bitrate?

128 kbps is about a megabyte a minute. Everything else follows from that.

Percentages, and the four sums people actually get wrong

20% off then 10% off is not 30% off, and adding 20% then taking it back leaves you short.

How to take a passport photo at home that is not rejected

The rule is the height of your head, not the size of the photo — and the shadow behind you is geometry.

How to make a ringtone, and why the cutting is the easy part

Android takes an MP3 straight. An iPhone wants an M4R, which is an M4A with a different extension.

Compound interest, in both directions

Savings growing and a card balance running away are the same sum. Only the side you are standing on differs.

What actually happens when a password leaks

Why one company’s bad week becomes your problem at forty other sites — and the single habit that breaks the chain.

What you can change in a PDF without Acrobat

Moving pages and stamping them costs nothing. Changing the words is the one genuinely hard edit, and this is why.

Are electronic signatures legally binding?

Valid nearly everywhere — but a drawn signature proves the mark is there, not who put it there. What that changes, and when it is not enough.

Why background removal cuts off hair

Hair, glass and plants come out ragged for a reason that is not fixable by trying another site. What causes it, and what to photograph instead.

Why OCR gets text wrong

Why the mistakes land in invoice numbers rather than in sentences, what actually ruins a scan, and how to photograph a page properly.

Why date calculators disagree with each other

One month after 31 January is 28 February, 2 March or 3 March depending on the rule. Why the calendar refuses to be arithmetic.

What fitness numbers actually tell you

Why the level a fitness formula gives you is usually wrong, why the change usually is not, and which of the two is worth watching.

What has to be on an invoice

The blocks nearly every country expects, the two that people get wrong, and why “net 30” gets paid later than a date.

Subtitles: a separate file, or burned into the video?

A file the player draws, or pixels in the picture. What each costs, and why automatic captions get names wrong and sentences right.

Why your final grade is not the average of your grades

The same four marks give 82.5 averaged and 74.0 weighted. How weighting works, and what you really need on the final.

Advertisement