Barcode Generator

Introduction

This barcode generator creates linear barcodes in three common formats: UPC-A, EAN-13, and Code-128. The purpose of the tool is simple. You type the data you want to encode, choose the barcode standard that matches your use case, and the page draws a clean barcode preview right in the browser. Because the encoding happens on your device, it feels fast, it works well for quick internal jobs, and it keeps the content you entered on your own machine rather than sending it to a remote service.

That makes the tool useful in several everyday situations. If you are testing a packaging mockup, you can generate a sample retail code. If you are labeling warehouse bins, shelves, or shipping cartons, you can make a Code-128 label from text such as an item code or location string. If you are building or auditing a small inventory workflow, you can quickly preview whether a number looks correct before you print it. The preview area below the form shows the barcode itself, while the message box tells you whether the current input is ready, invalid, or downloadable.

It also helps to know what this tool does not do. It does not assign official GS1 company prefixes, validate that a product number belongs to your business, or guarantee that every retailer will accept a printed label. Instead, it handles the encoding side: it turns correctly structured input into a barcode image. In practice, that means the tool is excellent for prototypes, internal labels, software tests, and educational use, while official retail deployment still depends on using properly assigned numbers and printing them at a readable size.

How to use the generator

The form has two main inputs. In the first field, enter the content you want to encode. For UPC-A and EAN-13, that content must be digits only. For Code-128, you can use ordinary printable text, including letters, numbers, spaces, and punctuation. In the second field, choose the barcode type that matches the data and the environment where the label will be scanned. The page updates as you type, so you can see immediately when the input fits the selected format.

The workflow is short and practical: enter a value, choose the symbology, review the preview, then copy or download the result. The copy button is handy when you want to paste the exact encoded value into another system, and the PNG download button gives you an image you can print or place into a document. If the form says the input is invalid, correct the characters or length first. That is especially important for numeric retail codes, because scanners rely on strict structure and checksum rules.

  1. Type the data to encode in the input field.
  2. Select UPC-A, EAN-13, or Code-128.
  3. Review the live preview and status message.
  4. Copy the data if you need to reuse it elsewhere.
  5. Download the PNG when the barcode looks correct.

If you are unsure which barcode type to choose, think about where the label will be used. UPC-A is common on retail items in North America. EAN-13 is common in international retail settings. Code-128 is flexible and popular for internal operations such as bin labels, asset tags, cartons, and shelf locations. The right barcode is not the one with the most features; it is the one your scanner, software, and workflow expect.

How barcode formats, lengths, and check digits work

Barcodes are not just pictures of black lines. They are structured encodings with strict rules about character sets, length, start and stop patterns, and error checking. In UPC-A and EAN-13, the final digit is a check digit. That digit is calculated from the earlier digits and helps detect common typing mistakes. If someone swaps digits or mistypes a number, the checksum often fails, which is one reason scanners and retail systems are so good at catching bad input before it causes downstream confusion.

UPC-A uses 12 digits total. The first 11 digits carry the number, and the 12th digit is the checksum. EAN-13 works similarly but uses 13 digits total, with the first 12 digits determining the last one. Code-128 is different. Instead of being locked to a numeric retail length, it can encode many printable characters and is designed for compact, information-dense labels. That flexibility is helpful in warehouses and internal systems, but it also means that a Code-128 label can become physically wide if you encode a long string and try to print it on a small label.

The UPC-A check digit can be summarized with the following MathML expression, which uses the odd-position and even-position sums from the first 11 digits:

CheckDigit = ( 10 - ( 3 ร— SumOdd + SumEven ) mod 10 ) mod 10

In plain language, you add the digits in alternating positions, weight one set more heavily, and then choose the final digit that makes the full total land on a multiple of ten. EAN-13 follows the same general idea with a different alternating weight pattern. The check digit does not make the barcode secret or secure. Its job is much simpler and very practical: it helps detect input errors. That is why a number that looks almost right can still fail in a scanner if the last digit does not match the mathematical rule.

The table below gives a quick comparison of the supported formats. It is useful when you want a fast reminder of what each symbology is designed to hold and where it is most often used.

Comparison of supported barcode formats
Format Allowed content Typical length Common use What to watch for
UPC-A Digits 0-9 only 12 digits fixed North American retail products Needs correct numeric length and a valid check digit
EAN-13 Digits 0-9 only 13 digits fixed International retail products Also depends on strict length and a valid final digit
Code-128 Printable text, numbers, and punctuation Variable Inventory, logistics, bins, cartons, internal labels Very long strings can print too wide for small labels

A good rule of thumb is this: if you are working with a product code that already belongs to a retail standard, use the matching retail symbology. If you are labeling things inside your own operation and you need letters, hyphens, or mixed codes, Code-128 is usually the better fit. And if you are generating test labels, always scan a printed sample before committing to a large batch. A barcode can look crisp on screen but still become unreadable if it is printed too small or on a poor background.

Worked examples and result interpretation

Suppose you want a warehouse location label for a shelf position such as RACK-A3-BIN-07. That is a good Code-128 case because the text mixes letters, numbers, and punctuation. Enter the value, choose Code-128, and the preview should show a dense barcode with readable text beneath it. When you scan the label, the scanner should return exactly the same string you typed. If the returned text differs even slightly, the usual cause is not the code itself but print quality, scaling, or an issue with the scanning app.

Now consider a retail-style example. If you already have a 12-digit UPC-A number, enter all 12 digits and choose UPC-A. The tool expects the full number, so the last digit should already be the checksum. If the preview appears and a scanner accepts the printed result, that tells you the structure is suitable for barcode generation. The same idea applies to EAN-13, except the number must contain 13 digits. Because the interface validates the selected format, wrong lengths are flagged before you waste time downloading an unusable image.

  1. Example retail code: enter 036000291452 and select UPC-A.
  2. Example global retail code: enter a 13-digit EAN such as 5901234123457 and select EAN-13.
  3. Example internal code: enter RACK-A3-BIN-07 and select Code-128.

When you interpret the result, pay attention to more than whether the bars simply appear on screen. Check that the human-readable text under the symbol matches the intended data. Make sure the format matches the purpose. Confirm that there is enough white space around the barcode, because scanners need a quiet zone on both sides to detect the edges. Finally, remember that Code-128 can represent many values, but that does not mean every long string is a practical label. Width matters. A shorter code that scans reliably is usually better than a long code that barely fits.

Printing, scanning, assumptions, and limits

Barcodes succeed or fail in the real world because of physical conditions as much as because of math. High contrast is essential. Dark bars on a light background are the safest choice, which is why black on white remains the default. Printing too small is one of the most common mistakes. The barcode may look sharp on a laptop screen, then become fuzzy, compressed, or crowded once it is sent to a low-quality printer or scaled down inside a document. If a label matters operationally, test it at the final print size with the scanner that will actually be used in the field.

This generator is intentionally simple. It does not register numbers with GS1, connect to your point-of-sale system, or synchronize an inventory database. It gives you a barcode image and leaves data governance to you. That means you should still manage ownership of product numbers, ensure internal codes are unique, and document how each code is used. For prototypes and internal workflows, that division of responsibility is usually fine. For regulated packaging and high-volume retail distribution, you will often need broader process controls than a standalone browser tool can provide.

There is also an important privacy benefit. The encoding logic runs in the browser, so the content you enter does not need to be posted to a server just to produce the image. That is convenient if you are working with internal identifiers, shelf maps, temporary shipment IDs, or sensitive operational labels. Even so, local privacy is not the same as organizational compliance. If you are bound by internal security rules, it is still wise to verify browser policy, printing policy, and storage practices for the files you download.

Finally, remember the core assumptions behind the validation. UPC-A and EAN-13 are treated as numeric retail formats with exact lengths. Code-128 is treated as a flexible text format for printable characters. If a scanner rejects a printed barcode, the most likely fixes are straightforward: confirm the input, confirm the selected format, enlarge the print, improve the contrast, and test again with proper quiet zones. Most failures come from a mismatch between the code and the workflow, or from a printing issue, not from a mysterious scanner problem.

Frequently asked questions

Can I use these barcodes on products sold in retail stores? You can use the generated images for prototypes, internal testing, and limited operational scenarios. For products entering major retail channels, the numbers themselves usually need to come from GS1 or another authorized numbering source so they do not conflict with codes assigned to other companies.

Are the check digits accurate? The underlying checksum rules follow the standard mathematics for the supported retail formats. If you enter correctly structured data, the resulting barcode structure will be consistent with the chosen symbology. As always, a real scanner test is the final confirmation before production use.

Can I use the generated images commercially? From a purely technical viewpoint, you can print and use the PNG files in your own business documents, labels, and internal systems. The separate legal question is whether you are entitled to use the encoded number, especially for retail identifiers that may belong to someone else.

Why will my scanner not read a barcode I printed? The most common causes are poor contrast, a barcode that was printed too small, damage to the label, or using the wrong barcode type for the receiving system. Start by checking the data, the size, the format, and the white space around the symbol.

Does this tool store or log my barcode data? The page is designed to work client-side, so generation does not require sending the barcode content to a server. Still, downloaded files, browser settings, and local workflows should be reviewed if you handle sensitive identifiers.

Use 12 digits for UPC-A, 13 digits for EAN-13, or printable text for Code-128.

Enter data and choose a format to preview a barcode.
The generated barcode preview appears here. Review the message above for validation details before downloading.

Play Routing Rush, an optional barcode mini-game

The calculator stands on its own, but if you want a faster way to internalize the format rules, try the mini-game below. Each package on the conveyor carries a code. Your job is to switch the diverter so the package reaches the correct printer lane before it passes the split. Valid 12-digit retail numbers go to UPC-A, valid 13-digit retail numbers go to EAN-13, mixed text goes to Code-128, and broken retail numbers belong in Reject. It is a quick, replayable way to practice the same choices you make in the generator.

Score0
Time75
Streak0
Lives4
PhaseWarm-up
Best0

Optional arcade challenge

Routing Rush

Click to play. Route valid 12-digit codes to UPC-A, valid 13-digit codes to EAN-13, mixed text to Code-128, and broken retail numbers to Reject. Tap a lane, click a lane, or press keys 1 to 4 before each package reaches the diverter.

Best score: 0

Takeaway: UPC-A and EAN-13 only work as retail barcodes when both the length and the check digit fit the standard.

Embed this calculator

Copy and paste the HTML below to add the Barcode Generator Tool - Create UPC-A, EAN-13, and Code-128 Barcodes to your website.