Explore Dika Ops

How to Create a Barcode for a Product: Format, Number and Test

How to create a barcode for a product: pick EAN-13 or UPC-A, use a genuine number, check the digit and test the printed label before you sell it.

7 min read E-commerce
Stacked brown cardboard product boxes with printed brand names

To create a barcode for a product, choose the format that the shops, marketplaces and carriers you sell through accept, enter a number that genuinely belongs to that product, let the check digit be calculated, and export the result as SVG for print. For most retail products sold worldwide that means EAN-13. The number itself should come from a GS1 member organisation, not from a generator, if your products will be sold through shops or marketplaces.

The steps below use our free barcode generator, which draws EAN, UPC, Code 128, Code 39 and ITF-14 codes in your browser and needs no sign-up. As you type, it shows the encoded value and the check digit, so most mistakes are caught before anything is printed. The same method works for one product or for a whole range, and the other free tools we publish are listed on the tools page.

Choose the right barcode format

The format decides which characters the code can hold and what the scanner at the other end expects to read. Use the table as a starting point, then check the requirements of the shop, marketplace or carrier you are selling through, because they sometimes ask for a specific format.

FormatWhat it holdsTypical use
EAN-1312 digits plus a check digit (13 in total)Retail products sold worldwide
EAN-88 digits including the check digitVery small packs where space is limited
UPC-A12 digits including the check digitRetail products sold in North America
Code 128Printable ASCII characters: letters, digits and symbolsInternal labels, stock locations, shipping references
Code 39Capital letters, digits and a few symbolsSimple internal labels and documents
ITF-1414 digits including the check digitOuter cartons and cases

For a product that goes on a shelf, EAN-13 or UPC-A is the normal choice. Code 128 is the usual choice for your own labels, because it holds letters and numbers without needing a registered number.

Step by step: create the barcode with the generator

  1. Open the tool. Go to the barcode generator and choose the format under Barcode format. Pick EAN-13 for retail products sold worldwide, or UPC-A for North American retail.
  2. Enter the value. Type the 12 digits without the check digit, and the tool adds it for you. If you already have a 13-digit number, type all of it and the tool verifies it instead. The example 590123412345 becomes 5901234123457, with the check digit 7 added. That is the tool's practice number, so do not print it on products you sell.
  3. Read the readout. Under the field, the readout shows the encoded value, the check digit and the length. If something is wrong, it says whether the length is off, a character is not a digit, or the check digit does not match.
  4. Adjust the bars. Set the bar width from 1 to 4 pixels and the height from 30 to 250 pixels. The defaults are a width of 2 and a height of 100, which suit most labels, and you can change them once you have seen the preview.
  5. Choose colours and text. Keep the bars black and the background white. Decide whether the number appears under the bars with the option Show the value under the bars. Most retail labels show it.
  6. Download the file. Use Download SVG for print, because it stays sharp at any size. Use Download PNG for a screen or a document. Reset clears the fields if you want to start again.
  7. Test the printed result. Print a sample and scan it, as described in the testing section below.

If you need the same settings again, the generator also accepts a link with the values already filled in, so a shared link or a script can open the tool with the format and number ready.

Warehouse pallet racking with cardboard boxes and a wooden pencil resting on a shelf
Stock on racking needs a code that scans at receiving and at dispatch, so every product and location label must pass the same test.

Get the number right before you print

The generator will draw any number that passes the check-digit test, but it cannot tell you whether the number belongs to you. A number can be valid and still be registered to another company. Retail products need a genuine number from the proper issuer, and for products sold through shops, marketplaces or wholesalers that issuer is GS1. In the United Kingdom, GS1 UK issues company prefixes, and you then assign product numbers within your own prefix.

Internal codes follow different rules. For stock locations, pallets, cartons and your own tracking references, you can create a numbering scheme yourself, provided every code is unique inside your system and the scheme is written down. Do not mix the two schemes in one field. A retail product should never carry an internal code in the place where a retailer expects a GTIN.

Size, contrast and margin for reliable scanning

A scanner reads the pattern of bars and spaces. It fails when the bars blur, the contrast is weak or the blank margin is too narrow. The rules are simple, and they matter more than the choice of tool.

  • Keep the quiet zone, the blank margin, on both sides of the bars. Do not print text, borders or lines inside it.
  • Print at a size the format allows. A standard EAN-13 is roughly 37 mm wide at its nominal size, and shrinking it too far makes the bars harder to read. Check GS1 guidance for the magnification limits of each format.
  • Stretch the code neither horizontally nor vertically, because the ratios between bars must stay exact.
  • Use matte paper or label stock where possible. Glossy film can reflect light back into the scanner.
  • Avoid red and pale colours. Many laser scanners ignore them, so black on white is the safe choice.

Test the printed barcode before you use it

A barcode is only correct when a scanner reads it. Test the real output, not the file on your screen, and test it in the conditions the product will face.

  1. Print a sample on the printer and label stock you will actually use.
  2. Scan it with the scanner or app used by the shop, warehouse or marketplace that receives the product. A phone camera is a quick check, but it is not a substitute for the real device.
  3. Scan from the angle and distance you would use at the till or on the receiving dock.
  4. Apply one label to a real product or carton and scan it there, because curved surfaces and shrink wrap change the result.
  5. Keep one scanned reference sample, and reprint and re-test whenever the label design, paper or printer changes.
Result of the testWhat it usually meansWhat to do
Scans on the first attemptSize, contrast and margin are rightRecord the settings and print the production run
Scans only at certain anglesGlare or a curved surfaceChange to matte stock or adjust the label position
Reads a wrong numberWrong format or a typing error in the valueCheck the format, re-enter the value and reprint
Does not scan at allBars too small, blurred or too close to the edgeIncrease the height and width and widen the margin

Common mistakes when creating a product barcode

  • Making up retail numbers. A number that looks valid is not registered to you, and a retailer will reject it or, worse, accept it and create a conflict with another product.
  • Typing the check digit by hand. One wrong digit makes the check fail. Enter the number without the check digit and let the tool calculate it.
  • Choosing the wrong format. Code 39 cannot hold lower case letters, and EAN formats cannot hold letters at all. Pick the format the receiving system expects.
  • Printing too small to save space. A scanner needs the bars to be wide enough to resolve. Use a larger label or a smaller number of items on the sheet.
  • Printing once and never testing again. A new printer ribbon, a different label roll or a changed design can all change the result.

The same barcode also works best when the product record in your system holds that exact number. Our barcode inventory system guide explains how the scanned code connects to stock records, and the stock count guide shows how to check that the records match the shelf.

Frequently asked questions

Can I create a barcode for a product for free?

Yes. A free generator draws EAN-13, UPC-A, Code 128 and other formats in your browser without an account. The free part is the drawing. The number itself has to be genuine, and a retailer or marketplace will check that it belongs to you.

Which barcode do shops and marketplaces usually ask for?

Most ask for a GTIN, which is the family of numbers that includes EAN-13, UPC-A and ITF-14. Check the requirements of each channel, because some accept only certain formats, and some ask for product images or data alongside the code.

Do I need to calculate the check digit myself?

No. Enter the 12 digits for EAN-13 or UPC-A and the generator calculates the final digit. If you already hold a 13-digit number, type it in full and the tool confirms whether the check digit is correct.

Can I use a barcode for my own stock without a GS1 number?

Yes, for internal use such as locations, pallets, cartons and your own references. Use Code 128 for these labels, keep the scheme unique and documented, and do not give internal codes to retailers in place of a genuine product number.

How do I know a barcode will scan?

Print a sample on the paper and printer you will use, scan it with the device the receiving party uses, and test it on a real product from a few angles. A code that scans reliably on the first sample is much more likely to scan across the production run.

Next step

Start by listing the numbers you genuinely own, then generate and test one label per product before you print a full run. Once the labels scan correctly, connect them to the product record so that every scan updates the same item. If you want that connection built into your sales, purchasing and stock work, our custom software team can talk it through, and you can start from our homepage. Dika Ops also includes barcode scanning in inventory on the same record as sales and finance, which you can see on the inventory module page.

Have a project in mind? Let us talk it through.

Tell us what you want to improve. We will reply with a clear next step.