Barcode Generator

JJ Ben-Joseph headshot JJ Ben-Joseph

How to Use This Barcode Generator

This tool lets you create UPC-A, EAN-13, and Code-128 barcodes directly in your browser. You can enter the data you want to encode, choose the barcode symbology, generate a scannable image, and download it as a PNG for printing on product labels, inventory stickers, or shipping documents. All processing happens locally in your browser for speed and privacy.

Use the quick steps below to generate a barcode:

  1. Enter the number or text you want to encode in the Data to encode field.
  2. Select UPC-A, EAN-13, or Code-128 from the Barcode type menu.
  3. Click Generate Barcode to render a scannable barcode image.
  4. Use the Copy Data button (if available) to reuse the encoded value in other systems.
  5. Click Download PNG to save the barcode image for printing or digital use.

Barcode Basics: What This Tool Generates

A barcode is a machine-readable representation of information. For linear barcodes like UPC-A, EAN-13, and Code-128, the pattern of dark bars and light spaces encodes digits or characters. A scanner reads the widths and positions of those elements, then converts them back into the original data.

Each barcode type (also called a symbology) follows strict rules about how data is encoded, how long it can be, and which characters are allowed:

The barcodes generated by this tool are intended for testing, internal labeling, and educational or workflow use. They follow the mathematical encoding rules of each symbology, but they do not automatically provide you with officially registered numbers from GS1 or other authorities.

Input Rules and Formulas for Each Barcode Type

To avoid invalid barcodes or scanner errors, it is important to follow the length and character rules of each symbology. The sections below outline the key rules and show how check digits are calculated conceptually.

UPC-A: 12-Digit Retail Barcode

Allowed characters: digits 0–9 only

Length: exactly 12 digits (including the check digit at the end)

UPC-A uses a single check digit at the end of the number to help detect common errors. The check digit is computed from the first 11 digits. In simplified form, the calculation can be expressed as:

CheckDigit = ( 10 - ( 3 × SumOdd + SumEven ) mod 10 ) mod 10

Where SumOdd is the sum of the digits in odd positions (1st, 3rd, 5th, etc.) from the left, and SumEven is the sum of the digits in even positions (2nd, 4th, 6th, etc.), both excluding the check digit itself.

Depending on how your implementation is configured, the tool may either:

If you enter too few or too many digits, or if you include non-numeric characters, the generator will either reject the input or produce a warning, depending on how validation is handled in the interface.

EAN-13: 13-Digit International Barcode

Allowed characters: digits 0–9 only

Length: exactly 13 digits (including the check digit at the end)

EAN-13 is similar to UPC-A but longer, with an additional digit and slightly different weighting in the check digit calculation. Conceptually, the check digit is computed from the first 12 digits by weighting alternate digits by 1 and 3 and then taking the result mod 10.

Typical behavior for EAN-13 input in generators is one of the following:

Non-numeric characters or the wrong length will result in invalid barcodes and should be corrected before use in production or printed materials.

Code-128: Flexible, High-Density Barcode

Allowed characters: typically the full 7-bit ASCII range (including digits, letters, spaces, and many punctuation symbols). Some implementations may restrict this slightly for simplicity.

Length: variable, with a practical maximum based on readability and scanner capabilities. Longer data strings create physically wider barcodes.

Code-128 uses internal start codes, character sets (A, B, and C), and a modulo-103 check character. The generator handles the internal encoding details, so you only need to provide the text or numbers to encode. However, keep in mind:

Choosing Between UPC-A, EAN-13, and Code-128

If you are not sure which barcode type to use, consider where and how the barcode will be scanned. Retail point-of-sale systems often expect UPC or EAN, whereas internal logistics systems frequently use Code-128 for flexibility.

Use this as a general guide:

Comparison of Supported Barcode Formats

Format Allowed characters Typical length Common use cases Notes
UPC-A Digits 0–9 only 12 digits (fixed) Retail products in North America; supermarket items; packaged goods Requires GS1-assigned company prefix for official retail usage
EAN-13 Digits 0–9 only 13 digits (fixed) Global retail products; books (alongside ISBN); consumer goods Includes a country/GS1 prefix; widely recognized in international commerce
Code-128 ASCII (numbers, letters, punctuation) Variable (practical upper limit depends on label size) Inventory labels; shipping cartons; internal asset tags; warehouse shelves High data density; supports both numbers and letters in a single barcode

Worked Example: Generating a Test Barcode

This example walks through creating a simple test barcode and checking that it behaves as expected when scanned.

Example 1: UPC-A Test Code

  1. In the Data to encode field, type 03600029145 (11 digits) if the implementation auto-calculates check digits, or 036000291452 (12 digits) if it expects the full UPC-A including the check digit.
  2. Select UPC-A from the Barcode type list.
  3. Click Generate Barcode. A UPC-A barcode representing your number should appear.
  4. Click Download PNG to save the image.
  5. Print the image on plain paper at 100% scale and scan it with a barcode scanner app on your phone. The decoded number should match what you entered.

Example 2: Code-128 Inventory Label

  1. Enter RACK-A3-BIN-07 into the Data to encode field.
  2. Select Code-128.
  3. Generate the barcode and download the PNG.
  4. Print the barcode on label paper and attach it to the shelf or bin.
  5. Use a handheld scanner or mobile app to verify that the scanned text exactly matches RACK-A3-BIN-07.

Interpreting the Results

When you generate a barcode with this tool, you are seeing a visual encoding of your input data. Keep the following in mind when reviewing and using the results:

If a scanner cannot read the barcode, the most common remedies are increasing the size of the printed barcode, ensuring higher print quality, or shortening the encoded data (especially for Code-128).

Limitations, Assumptions, and Validation Rules

This barcode generator is designed for convenience and learning, not for replacing official registration processes. Be aware of the following limitations and assumptions:

Privacy and Offline Use

Unlike many online barcode services, this tool performs all calculations directly in your browser using client-side code. This has several implications:

If you are subject to strict data handling policies, you should still verify that your browser, network, and any plugins meet your organization’s security requirements.

Practical Tips for Printing and Scanning

To get the best results from the barcodes you generate:

By following these guidelines and the input rules above, you can use this barcode generator as a reliable part of your labeling and tracking workflows.

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 some limited use cases. However, for products sold through major retailers, your numbers must usually come from GS1 or an authorized numbering authority to avoid conflicts with other manufacturers.

Are the check digits accurate?

The check digits are produced according to the standard mathematical rules of each symbology. As long as you provide valid input (correct length and characters), the generated check digits will be mathematically correct. Always verify with a scanner before deploying in production.

Can I use the generated images commercially?

From a technical standpoint, you can print and use the PNG images in your own business for internal labels, packaging tests, and similar tasks. Legal rights to use specific numbers (for example, a UPC that belongs to another company) are separate from the image generation itself and must be respected.

Why will my scanner not read a barcode I printed?

Common reasons include poor print quality, a barcode that is too small, insufficient contrast, damage to the printed label, or using an incorrect symbology for your system. Verify the data, increase the print size, and ensure you are using the expected format (UPC-A, EAN-13, or Code-128).

Does this tool store or log my barcode data?

The generator is designed to run entirely in your browser using client-side code, so it does not need to send your barcode content to a server. Nevertheless, always review your organization’s security guidelines when handling sensitive identifiers.

Enter data and choose a format to preview a barcode.

Embed this calculator

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