# Barcode generator: make an EAN-13 or Code 128 barcode for your labels

> Type a product code or SKU and download the barcode. EAN-13 gets its check digit added for you; Code 128 takes letters, digits and symbols. The barcode is drawn in your browser and nothing is uploaded.

- Web page: https://raqambooks.com/tools/barcode-generator/
- Last updated: 2026-10-31
- Published: 2026-10-31
- Other languages: [ar](https://raqambooks.com/ar/tools/barcode-generator.md), [ur](https://raqambooks.com/ur/tools/barcode-generator.md)

## Make an EAN-13 or Code 128 barcode

**Summary:** This free generator turns a product code into an EAN-13 or Code 128 barcode you can download as PNG or SVG and print on labels. For EAN-13 type 12 digits and the check digit is added, or 13 digits and it is verified. Code 128 takes up to 40 letters, digits or symbols. Everything is drawn in your browser.

> Interactive tool: runs in the browser, nothing is uploaded. Use the web page.

## How an EAN-13 check digit and symbol are built

**Summary:** An EAN-13 has 13 digits: twelve data digits and a check digit. The check digit is found by weighting the twelve digits alternately 1 and 3, adding them, and taking the amount that rounds the sum up to the next ten. The symbol is drawn as 95 modules, narrow bar or space units, between guard bars.

```
sum   = d1*1 + d2*3 + d3*1 + d4*3 + ... + d11*1 + d12*3
check = (10 - (sum mod 10)) mod 10
```

### A worked example

**Check digit of 590123412345**

| Step | Working | Result |
| --- | --- | --- |
| Twelve digits | Typed by you | 590123412345 |
| Weighted sum | 5*1 + 9*3 + 0*1 + 1*3 + 2*1 + 3*3 + 4*1 + 1*3 + 2*1 + 3*3 + 4*1 + 5*3 | 83 |
| Check digit | (10 - (83 mod 10)) mod 10 | 7 |
| Full EAN-13 | Twelve digits, then the check digit | 5901234123457 |

### The 95 modules of the symbol

The first digit is not drawn as bars. It chooses which of two bar patterns each of the six left digits uses, which is how a scanner reads the first digit back. The six right digits always use one pattern.

**Layout of an EAN-13 symbol**

| Part | Modules |
| --- | --- |
| Start guard | 3 |
| Six left digits (7 modules each) | 42 |
| Centre guard | 5 |
| Six right digits (7 modules each) | 42 |
| End guard | 3 |
| Total | 95 |

## How Code 128 picks a subset and its checksum

**Summary:** Code 128 stores any printable ASCII text. The generator uses subset C, which packs two digits into each symbol, when the code is an even run of digits, and subset B otherwise. The checksum is the start value plus each symbol value times its position, modulo 103, and each symbol is 11 modules wide.

**Two Code 128 examples, computed by the generator**

| Code | Subset | Checksum | Modules |
| --- | --- | --- | --- |
| 123456 | C | 44 | 68 |
| SKU-00123 | B | 32 | 134 |

_The symbols for 123456 are 105, 12, 34, 56, 44, 106: the start symbol, three digit pairs, the checksum and the stop symbol. Code 128 cannot hold Arabic or other non-ASCII letters, so write codes in Latin letters and digits._

```
subset C: an even number of digits, two digits per symbol
subset B: any other text of printable ASCII characters
checksum = (start + 1*v1 + 2*v2 + 3*v3 + ...) mod 103
modules  = 11 per symbol (start, data, checksum) + 13 for the stop symbol
```

## Printing labels that scan

**Summary:** A barcode scans best when it is printed dark on a light background with its blank margin left intact. Download the SVG for sharp scaling or the PNG for quick use, print a few labels, and test-scan one with the scanner you will use at the counter. Scanners in keyboard mode type the code like a keyboard.

- **Keep the blank margin**: The downloaded image includes a blank margin on both sides of the bars. Do not crop it, because a scanner uses it to find where the barcode starts.
- **Scale it evenly**: Enlarge or reduce the image in proportion. Stretching it in one direction changes the bar widths a scanner relies on.
- **Test-scan a printed label**: Print one label, scan it into a text box and check that the whole code appears. Do this on the printer and scanner you will really use. Setup steps are in the [thermal printer and barcode setup guide](https://raqambooks.com/docs/thermal-printer-barcode-setup/).
- **Check the hardware first**: Not sure your scanner or label printer will work with your computer? Use the [POS hardware checker](https://raqambooks.com/tools/pos-hardware-checker/) before you buy rolls of labels.

## Which numbers you can use: internal codes and GS1

**Summary:** EAN-13 numbers that start with 2 are meant for use inside your own business, such as shelf labels and weighed goods. To sell through other shops, products normally carry numbers registered with GS1, so ask GS1 or your buyer. For an internal SKU or a code with letters, such as a shelf, batch or purchase order, use Code 128.

The [POS](https://raqambooks.com/features/pos/) scans these barcodes at the counter, and the [purchase and inventory module](https://raqambooks.com/features/purchase-inventory/) keeps the item codes behind them.

> **The generator checks arithmetic, not ownership** It confirms that a check digit is correct. It cannot tell whether a number is registered to a company, and it does not register numbers. It makes EAN-13 and Code 128 only, not EAN-8, UPC, QR codes or GS1-128.

## Frequently asked questions

**Can I use these codes on products sold in other shops?**

EAN-13 numbers that start with 2 are meant for use inside your own business, such as shelf labels and weighed goods. To sell through other shops, products normally carry numbers registered with GS1. Ask GS1 or your buyer.

**Which type should I choose, EAN-13 or Code 128?**

Choose EAN-13 for a thirteen-digit retail number. Choose Code 128 for an internal SKU or a code with letters, such as a shelf, a batch or a purchase order. Code 128 holds up to 40 Latin letters, digits and symbols in this tool.

**Why does EAN-13 need a check digit?**

The last digit lets a scanner catch a misread or a mistyped number: if the twelve digits and the check digit do not agree, the code is rejected. Type 12 digits and the tool adds the right one, or type 13 and it tells you the digit it expected.

**Will my barcode scanner read the printed label?**

Usually, if the label is printed dark on a light background, scaled evenly and with its blank margin intact. Scanners in keyboard mode type the code into the selected box. Print one label and scan it before you print a roll.

**Is what I enter sent anywhere?**

No. The calculation runs in your browser with no network request and nothing is stored. Closing or reloading the page clears what you typed. The only thing that can leave the page is a result you choose to copy or download.

## Related pages

- [POS hardware checker](https://raqambooks.com/tools/pos-hardware-checker/): Free POS hardware checker: pick a receipt printer, barcode scanner, label printer or cash drawer to see how likely it is to work and what to test first.
- [Point of Sale (POS)](https://raqambooks.com/features/pos/): Offline-ready POS for Windows and macOS: barcode scanning, ESC/POS thermal receipts, cash drawer, bilingual EN/AR receipts and shift closing.
- [Purchase & Inventory](https://raqambooks.com/features/purchase-inventory/): Supplier purchase orders, landed-cost calculation, multi-warehouse transfers, batch and expiry tracking and low-stock alerts in an offline desktop ERP.
- [Printer & scanner setup](https://raqambooks.com/docs/thermal-printer-barcode-setup/): Set up an ESC/POS 58 or 80 mm thermal receipt printer, Arabic code page, cash drawer and a keyboard-wedge barcode scanner (Enter suffix). Includes fixes.
- [Retail & Supermarkets](https://raqambooks.com/industries/retail/): Offline POS and ERP for GCC shops and supermarkets: barcode checkout, batch and expiry tracking, low-stock alerts, shift closing and VAT per item.

## Download RaqamBooks and run your business offline

Install it on your own computer, keep your data local and avoid per-user monthly cloud fees. Early version for Windows 10/11 and macOS 13 or later (Apple chip and Intel chip).

[All downloads, checksums and install guide](https://raqambooks.com/download/)
