Free tool
Barcode Generator (Code 128, EAN-13, UPC-A)
Create Code 128, EAN-13 and UPC-A barcodes with the check digit calculated for you, then download SVG or PNG. Input is validated and stays in your browser.
Code 128 accepts ASCII letters, digits and symbols, up to 80 characters.
Runs entirely in your browser. Nothing you type or upload is sent to our servers.
How to make a barcode
- Pick Code 128, EAN-13 or UPC-A.
- Type the text or number. For EAN-13 and UPC-A, enter the number without the check digit and the tool adds it, or enter all digits and it checks the last one.
- Adjust size and colors, then download an SVG or a PNG.
Worked example: the EAN-13 check digit
For the number 400638133393, multiply the last digit by 3, the one before it by 1, and keep alternating 3 and 1 going left. For this 12-digit number the weights from left to right are therefore 1, 3, 1, 3 and so on:
4x1 + 0x3 + 0x1 + 6x3 + 3x1 + 8x3 + 1x1 + 3x3 + 3x1 + 3x3 + 9x1 + 3x3 = 89
The next multiple of 10 above 89 is 90, so the check digit is 1 and the full number is 4006381333931. The result is 95 modules wide. For UPC-A the same calculation applies to its 11 digits: 03600029145 gives the full number 036000291452.
Worked example: the Code 128 check symbol
Code 128 stores a check symbol after the data. For the text Hi the tool picks code set B, whose symbol values are the character code minus 32: H is 40 and i is 73. The start symbol for set B has the value 104. The check symbol is the start value plus each data value times its position (1, 2, ...), divided by 103, keeping the remainder:
104 + 40x1 + 73x2 = 290, and 290 divided by 103 leaves 84, so the symbols are 104, 40, 73, 84, 106 (the last one is the stop symbol, 106).
For 12345678 the tool switches to code set C, which stores two digits per symbol, giving 105, 12, 34, 56, 78, 47, 106: start 105, then 12, 34, 56, 78, then the check symbol 47 and the stop.
What this tool does and does not do
- Validation. EAN-13 and UPC-A accept digits only, spaces and hyphens ignored, with the right length and a correct check digit. Code 128 accepts ASCII characters (up to 80) and chooses sets A, B and C to keep the barcode short.
- No product numbers issued. You supply the number.
- Test before printing. Scan a printed sample with the scanner or app you will actually use.
For a code that holds a link, use the QR code generator. Putting the barcode in a document? Add it to an invoice, or convert the SVG with SVG to PNG.
Frequently asked questions
Which barcode type should I choose?
Choose EAN-13 or UPC-A when you have a numeric product number of that exact length, and Code 128 for everything else, such as order numbers, serial numbers, asset tags and shipping labels with letters or digits. This tool encodes ASCII text, meaning letters, digits, punctuation and control characters, as Code 128, and it picks the shortest encoding automatically.
How is the EAN-13 or UPC-A check digit calculated?
Take the digits before the check digit. Going from the right, multiply the last one by 3, the next by 1, then 3, 1 and so on. Add the products, divide the total by 10, and subtract the remainder from 10, using 0 when the remainder is 0. For 400638133393 the total is 89 and the check digit is 1.
What if I enter the check digit myself?
You can enter the full number, 13 digits for EAN-13 or 12 for UPC-A. The tool recalculates the check digit and, if the last digit does not match, shows the digit it expected instead of drawing a barcode that would be wrong. Spaces and hyphens in the number are ignored.
Does this tool give me an official product number?
No. It only turns a number you enter into bars. It does not issue, register or look up product numbers, so a number you invent may already belong to someone else. Use the numbers you have been assigned for your products, and check the requirements of the marketplace or retailer you sell through.
Should I download SVG or PNG?
SVG is made of shapes, so it stays sharp at any size and suits print and design files. PNG is a fixed-size picture that is easy to paste into documents and web pages. The PNG has the same pixel size you see in the preview, so raise the bar width setting before you download if you need a larger one.
What are the bar width, height and margin settings?
Bar width is the width in pixels of the thinnest bar, called a module, and every other bar is a whole number of modules wide. Height is the bar height in pixels. Margin is the empty space on each side, counted in modules. The default margin is 10 modules. Test-scan a printed sample before printing a large run.
Is the number I type uploaded anywhere?
No. Encoding and drawing happen in your browser, and the SVG and PNG files are created on your device. Nothing is sent to a server or stored, and analytics record only that the tool was used, never what you typed.
Link to this tool
Found it useful? Copy a link for your page, newsletter or documentation.
Get new tools and guides by email
Optional. The tool above works without signing up.
More free tools
Browse all image tools or the full list of free tools.
- QR Code GeneratorCreate a QR code for any link or text with custom colors. Download as PNG or SVG. Free, no sign-up, and nothing leaves your browser.
- Image Compressor & ResizerCompress and resize JPG, PNG and WebP images in your browser. Nothing is uploaded, so your files stay private.
- Image Format Converter (PNG, JPG, WebP)Convert images between PNG, JPG and WebP in bulk, right in your browser. Nothing is uploaded, so your files stay private.
- Image Metadata (EXIF) RemoverRemove location, camera and date metadata from photos before you share them. Runs in your browser and your files never leave your device.
- Emoji Copy and PasteSearch about 1,900 emoji by name or keyword, browse them by category, and copy any of them with one click. The emoji you pick are never sent anywhere.
- Email Signature GeneratorBuild an HTML email signature with your name, contact details, links and optional image, then copy it as rich text or HTML. Nothing is uploaded or stored.