tools / barcode
barcode/
Turn a number or text into a UPC-A, EAN-13, EAN-8 or Code 128 barcode with the check digit calculated, then download SVG or PNG. It only draws; it does not issue product numbers, and nothing is uploaded.
| Full content |
|---|
Barcode
Enter a number to preview it here
What are UPC-A, EAN-13 and Code 128
UPC-A and EAN-13 are GS1 product barcodes of 12 and 13 digits, the last of which is a check digit; Code 128 is specified in ISO/IEC 15417. This page draws an existing number, or text in ASCII 32–126, as one of these barcodes and calculates the check digit.
How it works: the check digit and the bars
- Check digit: going from right to left, multiply the rightmost data digit by 3, the next by 1, and so on, then add the results; the check digit is what it takes to bring the sum up to the next multiple of 10. UPC-A, EAN-13 and EAN-8 all work this way.
- EAN-13 draws each digit as two bars and two spaces 7 modules wide. The left 6 digits use the L or G pattern depending on the first digit (all L when it is 0), the right 6 always use R; the first digit itself has no bars and is only printed on the left. With the guard bars at both ends and in the middle that makes 95 modules. UPC-A is an EAN-13 whose first digit is 0; EAN-8 has 4 digits on each side, 67 modules in all.
- Each Code 128 symbol is 11 modules wide; the stop symbol plus the final bar is 13 modules. Code set B holds ASCII 32–126, and a character's value is its ASCII code minus 32; code set C packs two digits into one symbol. This page switches to code set C for 4 or more digits in a row at the start or end, 6 or more in the middle, or when the whole text is 2 or 4 or more digits.
- The Code 128 check symbol: take the start symbol's value, add each symbol's value times its position, and take the remainder after dividing by 103. Start B has the value 104, start C 105.
This page leaves 11 modules of blank space on each side of EAN and UPC barcodes and 10 modules on each side of Code 128; Wikipedia gives the minimum quiet zone as 9 modules for UPC-A and 10 modules for Code 128.
Example
The first example is the one on the GS1 check digit page: weighting the 12 digits alternately by 1 and 3 gives a sum of 57, which is 3 short of 60. The second is a UPC-A: its 11 digits give the check digit 2.
- Input
type ean13 digits 629104150021
- Output
check_digit 3 full 6291041500213
- Input
type upca digits 03600029145
- Output
check_digit 2 full 036000291452
Sources
FAQ
Can I use a UPC barcode made here to sell products in stores
Not with a number you made up. As Wikipedia notes, the numbers used in UPC and EAN barcodes are assigned by the international organisation GS1. This page does not issue or register numbers and cannot check whether a number is already in use; it only draws a number you already have.
What does "Wrong check digit" mean, and how is the check digit calculated
The last digit does not match the one the rule gives, usually because one digit was copied wrongly. From right to left, multiply the rightmost data digit by 3, the next by 1, and so on, add them up, and see how much is missing to the next multiple of 10: that is the check digit. If you enter only the leading digits (11 for UPC-A, 12 for EAN-13, 7 for EAN-8), the page adds the check digit for you.
How are UPC-A and EAN-13 related
Put a 0 in front of a 12-digit UPC-A and you have a 13-digit EAN-13 with exactly the same bars and the same check digit (a leading 0 adds 0 whatever its weight). So to enter a UPC-A number as EAN-13, just add a 0 in front.
What can Code 128 hold, and why not Chinese
This page's Code 128 uses only code sets B and C, so it takes letters, digits, symbols and spaces from ASCII 32–126, up to 80 characters. Chinese characters and full-width symbols are outside that range, and Code 128 itself cannot hold Chinese; the control characters of code set A and the FNC function characters are not supported here. For Chinese, use a QR code.
The barcode will not scan: what should I check
Check three things first: the module width is too small (the bars print too thin; raise the module width or print the SVG larger), the barcode was stretched in only one direction when printing, or the blank margins were cut off (scanners use the quiet zone to find where the barcode starts). This page always uses black bars on white, with no colours or inverted versions. The number itself must also be right; with a wrong check digit the page does not draw anything.
PNG or SVG, and what size should I print
The PNG is (the barcode's modules plus both quiet zones) times the module width wide, good for web pages and documents; the SVG is a vector image that stays sharp when enlarged, good for print. Scale it proportionally when printing, never only wider or only taller. Barcodes on product packaging have retail size requirements: follow the specification from GS1 or your printer, since this page does not choose a size for you.
Where can I make a QR code
Use this site's QR code generator, listed under related tools at the bottom of the page. A barcode holds one line of digits or short text; a QR code can hold longer text, web addresses and Chinese.
Are the numbers and text I enter uploaded
No. Encoding, drawing and creating the PNG and SVG files all happen in your browser with no network requests and nothing saved; reloading the page clears it.