All tools › Text, Fonts & Symbols › Generators
Create Code 128, EAN-13, UPC-A or Code 39 barcodes with the check digit worked out, then download PNG or SVG.
What the barcode generator does
This barcode generator draws four common linear barcodes: Code 128, EAN-13, UPC-A and Code 39. Download the result as a PNG or SVG file with the quiet zones and a readable text line already in place.
Everything runs in your own browser. The data you type is not uploaded or saved. For EAN-13 and UPC-A the page also calculates the check digit, or checks the one you typed and tells you if it is wrong.
How to use the barcode generator
- Pick the Barcode type.
- Type into Text or number to encode. Spaces and dashes inside EAN and UPC numbers are ignored.
- For Code 39 only, tick Code 39 only: add the optional modulo 43 check character if your scanner setup expects one.
- Press Generate barcode, then Download PNG or Download SVG.
Which barcode type to choose
| Type | What it holds here | Usual job |
|---|---|---|
| Code 128 | Up to 60 keyboard characters, upper and lower case | Inventory, shipping and asset labels |
| EAN-13 | 12 digits plus a check digit | Retail products worldwide |
| UPC-A | 11 digits plus a check digit | Retail products, mainly United States and Canada |
| Code 39 | Up to 40 capital letters, digits, space and – . $ / + % | Older industrial label systems |
When Code 128 data is all digits with an even count of four or more, the tool uses code set C, which packs two digits into each symbol; anything else uses code set B.
How the check digit is calculated
EAN-13 and UPC-A end in a check digit so a scanner can catch a misread. The tool uses the standard GS1 method:
check digit = (10 – ((3 x A + B) mod 10)) mod 10
- A is the sum of the digits in the 1st, 3rd, 5th … places counted from the right-hand end of the number without its check digit.
- B is the sum of the remaining digits.
- mod 10 means the remainder after dividing by 10.
Code 128 always carries a check symbol: the start value plus each symbol value times its position, modulo 103. It is in the bars but not in the text line. The optional Code 39 check character is the sum of the character values modulo 43.
Worked example
Choose EAN-13 and type 400638133393. Counting from the right, A = 3 + 3 + 3 + 8 + 6 + 0 = 23 and B = 9 + 3 + 1 + 3 + 0 + 4 = 20. Then 3 x 23 + 20 = 89, the remainder is 9, and 10 – 9 = 1. The page shows 4006381333931, “1 (calculated and added)”, and the text line 4 006381 333931.
| Type and input | Data encoded | Check digit | Modules wide |
|---|---|---|---|
| Code 128, INV-7731-A | INV-7731-A (code set B) | 81 | 145 |
| Code 128, 00123456 | 00123456 (code set C) | 43 | 79 |
| UPC-A, 01234567890 | 012345678905 | 5 | 95 |
| Code 39, BIN 42, check ticked | BIN 42A | A (value 10) | 143 |
Reading the result
A module is the width of the thinnest bar. “Modules wide” gives the barcode width in those units, before and after adding quiet zones. The quiet zones are the blank margins at each end: 11 modules left and 7 right for EAN-13, 9 on each side for UPC-A, and 10 on each side for Code 128 and Code 39 on this page.
Retail numbers must come from GS1
This page draws the bars for any number that passes the check digit test. It does not issue numbers. For products sold in stores or on large marketplaces, the EAN or UPC number has to be licensed from GS1, the organization that runs the retail numbering system, so that it is registered to your company. A number you make up will still scan, but it may belong to someone else’s product. For labels used only inside your own business, any numbering is fine.
Limits and printing tips
- Code 128 here takes ordinary keyboard characters only: no accented letters or control codes.
- EAN-8, UPC-E, ITF-14 and add-on codes are not included, and all bars are drawn the same height.
- Keep the white margins clear and print dark bars on a light background. Do not shrink a long barcode until the thin bars blur.
- Scan a printed sample with the scanner or app that will be used before you print a batch.
Frequently asked questions
Is a UPC-A barcode the same as an EAN-13?
The bars of a UPC-A are identical to an EAN-13 that starts with 0. Some scanners report a UPC with an extra zero in front for that reason.
Why does it say my check digit does not match?
You typed a full 13-digit EAN or 12-digit UPC and the last digit is not the one the formula gives.
Why did my lower-case letters turn into capitals in Code 39?
Standard Code 39 has no lower-case letters, so the tool capitalizes them. Use Code 128 to keep upper and lower case.
What are the asterisks under a Code 39 barcode?
They stand for the start and stop pattern at each end. They are not part of your data.
Related calculators
- QR Code Generator for links and longer text that a phone camera can read.
- Unit Converter to switch label sizes between inches and millimeters.
- Random Number Generator for test numbers on internal labels.

