Barcode Generator
Make Code 128, EAN-13, UPC-A, EAN-8 and Code 39 barcodes in your browser. Check digits are calculated and verified. Download as SVG or PNG.
Code 128 · 165 modules wide with quiet zones · SVG 330 × 111 px · PNG 660 × 222 px
Letters, digits and punctuation (printable ASCII), up to 80 characters.
13 symbol characters, digit pairs packed with subset C, check value 24 (modulo 103).
The barcode is drawn in your browser and the value is not sent to our server. The preview shrinks to fit a narrow screen; the downloaded files are always exact.
01 · Definition
What is a barcode generator?
A barcode generator turns a number or a short text into a pattern of bars and spaces that a scanner reads back. Retail products carry EAN-13 or UPC-A, which hold a product number ending in a check digit. Code 128 and Code 39 hold letters and digits and are used on internal labels for stock, assets and parcels.
02 · Overview
How the Barcode Generator works
The tool draws five linear barcode types from a number or text you type. EAN-13, UPC-A and EAN-8 take the digits with or without the final check digit: a missing one is added, and a wrong one is reported with the correct value. Code 128 covers printable ASCII, switches between subsets B and C to keep the symbol as short as possible, and adds its modulo 103 check character. Code 39 covers capitals, digits and seven symbols. Every symbol includes its quiet zones and optional text under the bars. Bar width and height are adjustable, and the PNG is drawn at a whole number of pixels per bar module so the edges stay sharp. The barcode is drawn in your browser and the value is not sent to our server.
03 · Guide
Code 128 vs EAN-13 vs UPC-A vs Code 39
Pick the type by what has to scan it. A shop till expects EAN-13 or UPC-A, and the number in it has to be a GTIN licensed from GS1. For labels you control, such as shelf locations, asset tags and order numbers, Code 128 is the usual choice: it holds any printable ASCII character and is much narrower than Code 39 for the same content.
The widths below were counted by this tool's encoder for the 12-digit value 123456789012 (8 digits for EAN-8) and include the quiet zones. Multiply by the width of one module to get the printed width. Code 128 is short for digits because subset C packs two digits into each symbol character.
| Type | Holds | Check | Width |
|---|---|---|---|
| Code 128 | ASCII 32 to 126, up to 80 characters here | Modulo 103 character, added | 121 modules |
| EAN-13 | 13 digits | Last digit, GS1 modulo 10 | 113 modules |
| UPC-A | 12 digits | Last digit, GS1 modulo 10 | 113 modules |
| EAN-8 | 8 digits | Last digit, GS1 modulo 10 | 81 modules |
| Code 39 | A to Z, 0 to 9, space and - . $ / + %, up to 40 here | None | 243 modules |
04 · Guide
How the EAN and UPC check digit is calculated
Start from the right-hand end of the number without its check digit. Multiply the last digit by 3, the one before it by 1, the one before that by 3, and so on. Add the results. The check digit is whatever brings that total up to the next multiple of ten, or 0 if it is already one.
For 629104150021 the products are 6, 6, 9, 3, 0, 12, 1, 15, 0, 0, 2 and 3, which add up to 57. The next multiple of ten is 60, so the check digit is 3 and the full EAN-13 is 6291041500213. The same rule gives the last digit of UPC-A and EAN-8. The rows below were computed with this tool.
| Digits entered | Type | Weighted sum | Check digit |
|---|---|---|---|
| 629104150021 | EAN-13 | 57 | 3 |
| 400638133393 | EAN-13 | 89 | 1 |
| 03600029145 | UPC-A | 58 | 2 |
| 1234567 | EAN-8 | 60 | 0 |
05 · Use cases
When to use the Barcode Generator
- 01
Label shelves, bins and assets with Code 128 for a handheld scanner
- 02
Check or complete the last digit of an EAN-13 or UPC-A number
- 03
Put a sample barcode in a packaging mock-up or a test fixture
- 04
Export a barcode as SVG to place in a print layout
06 · Examples
Barcode Generator examples
EAN-13, 629104150021
ex 016291041500213
Twelve digits entered, check digit 3 added. The symbol is 95 modules of bars plus quiet zones of 11 and 7 modules, 113 in all.
UPC-A, 03600029145
ex 02036000291452
Eleven digits entered, check digit 2 added.
EAN-13, 6291041500215
ex 03The check digit is wrong. For 629104150021 it should be 3, not 5.
A 13-digit number is verified instead of redrawn. One button replaces it with 6291041500213.
Code 128, ABC-1234567890
ex 0413 symbol characters, digit pairs packed with subset C, check value 24 (modulo 103)
The letters use subset B and the ten digits use five subset C characters. 165 modules wide with quiet zones.
07 · FAQ
Barcode: frequently asked questions
Which barcode type should I use?
How is the check digit worked out?
Can I put these barcodes on products I sell?
What size should an EAN or UPC barcode be printed?
Should I download SVG or PNG?
Will the barcode scan?
Which barcode types are not supported?
Is the value I type sent to your server?
08 · Reference
Specs and further reading
These are the primary sources this tool follows. Where a specification defines the behaviour, we link the specification, not a summary of it.
- ISO/IEC 15417:2007, Code 128 bar code symbology specification
ISO/IEC. The standard that defines Code 128: character encoding, dimensions and the check character.
- EAN/UPC Symbol Reference
GS1 Canada. Nominal module width of 0.33 mm, the 80% to 200% size range, and symbol widths and minimum bar heights at each size.
- Guidelines for size
GS1 Sweden. Quiet zones in modules: 11 left and 7 right for EAN-13, 7 each side for EAN-8, 9 each side for UPC-A.
- Check Digit Calculator
GS1 US. GS1's own calculator for GTIN-8, GTIN-12 and GTIN-13 check digits, to compare results against.
- How to Get UPC Barcodes for Products
GS1 US. How product numbers are licensed, as a single GTIN or a company prefix.
09 · More
Tools that pair with Barcode
QR Code Generator
Make a QR code for a URL, text, a WiFi network or a vCard contact. Download as SVG or PNG up to 2,048 px. Codes are static, with no redirect or expiry.
Test Credit Card Numbers
Stripe's published test card numbers in one filterable list: successful payments by brand, declines by reason, and 3D Secure. They work in test mode only.
UUID Generator
Generate UUID v4, v7 or v1, one at a time or up to 1,000. Output as standard, uppercase, braces (GUID), no hyphens, URN or Base64, and decode any UUID you paste.