HakoTools

EAN-13 & Code 128 Barcode Generator with Check Digit

Type a number or an asset tag and get a scannable EAN-13, EAN-8 or Code 128 barcode instantly. For EAN the check digit is calculated for you, and a full number you paste is verified against the GS1 formula so a typo doesn't slip through.

Everything you enter stays in this browser on your device. Nothing is sent to a server.How to check

Published: / Updated: / Published by the HakoTools team

Generate several barcodes at once (for printing)

How it works

What does this barcode generator do?

It generates EAN-13, EAN-8 and Code 128 barcodes. For EAN it handles the check digit two ways: give it the data digits and it calculates the check digit, or paste a full number and it verifies the check digit against the standard formula instead of trusting it blindly. Code 128 takes letters, digits and symbols, so an asset tag like ABC-001 works too. Output comes as SVG or PNG, and a batch mode lays out several barcodes on an A4 label sheet as a PDF.

How to use it

  1. Pick a format: EAN-13 (12 data digits), EAN-8 (7 data digits) or Code 128 (ASCII text)
  2. Type the value. For EAN, enter the data digits alone and the check digit is added automatically, or enter the full number (data plus check digit) and it gets verified. For Code 128, type the letters, digits and symbols as they are
  3. Press Generate barcode to see the preview
  4. Adjust bar width, height, or whether the text is shown below the bars (no need to regenerate)
  5. Download as PNG (screens, digital use) or SVG (print, scaling up)

To print several barcodes with the same settings, scroll to Generate several barcodes at once (for printing), enter one value per line and press Generate all. Then use Lay out on an A4 label sheet (PDF) to set the columns, rows and margins of your label sheet and download the PDF.

How is the check digit calculated?

EAN-13 and EAN-8 both use GS1's modulus-10, weight-3 checksum. Starting from the digit immediately to the left of the check digit and moving left, multiply alternating digits by 3 and 1, add the products, and subtract the result (mod 10) from 10 — using 0 instead of 10 when the remainder is already 0.

Worked example for the 12-digit EAN-13 data 501234567890: weighting each digit 3, 1, 3, 1, … from the left gives a sum of 90. 90 mod 10 is 0, so the check digit is 10 − 0 = 0, making the full number 5012345678900.

PositionDigitWeightProduct
15×15
20×30
31×11
42×36
53×13
64×312
75×15
86×318
97×17
108×324
119×19
120×30

EAN-8 has 7 data digits (an odd count), so the weight assignment shifts by one position compared with EAN-13's 12. This tool runs the same formula for both, so you never need to do it by hand.

What do the guard bars mean?

An EAN-13 barcode is 95 modules wide. Fixed patterns called guard bars mark the start (101), middle (01010), and end (101) so a scanner can find the code and tell where it splits into two halves. The first digit of an EAN-13 is never drawn as bars at all — it is encoded indirectly, in which of two parity patterns (L-code or G-code) each of the next 6 digits uses.

Structure of EAN-13 50123456789005012345678900guard bars (highlighted)

The leading digit 5 sits outside the bars entirely — it is recovered from the L/G parity pattern of the first 6-digit block, not printed as its own set of stripes.

EAN-13 vs UPC-A vs Code 128 — which do I need?

FormatDigitsWhere it's usedSupported here
EAN-1313 (12 + check)Retail, most countries outside North AmericaYes
EAN-88 (7 + check)Small packaging where EAN-13 doesn't fitYes
UPC-A12Retail, US and CanadaNo — use EAN-13 with a leading 0
Code 128Variable, any ASCIIShipping labels, internal trackingYes (not GS1-128)

A UPC-A number is compatible with EAN-13 scanners when read as an EAN-13 with a leading 0, so this tool covers that case without a separate UPC-A mode.

Can I license my own number, or is this only for internal use?

A real, sellable EAN-13 starts with a GS1 company prefix assigned to a specific business by a GS1 member organization (GS1 US, GS1 UK, and so on); the rest of the number is that business's own item codes plus a check digit. Typing in an unassigned number and printing it does not make it a valid retail barcode — a store's point-of-sale system checks it against the real registry. This tool is built for cases that don't need that registration: internal inventory tags, event badges, asset labels, or anything else where the number only needs to be internally consistent.

What's the recommended print size?

EAN-13's nominal (100%) size has a module width (the "X dimension") of 0.33mm and a total bar width of about 37.29mm, per the GS1 General Specifications. Shrinking below that makes the narrowest bars harder for a scanner to resolve; the bar width setting here is in pixels on-screen, so scale it to your printer's resolution rather than assuming the on-screen size matches the printed size. A quiet zone (blank margin) is required on both sides for the scanner to find the start and end guards, and this tool adds one automatically to both the SVG and PNG output — don't crop it out when placing the barcode in a design.

Is the data I enter sent anywhere?

No. Encoding, check-digit calculation, and the PNG, SVG and label-sheet PDF exports all run in your browser's JavaScript. Nothing you type is transmitted to a server.

What else can I make with the other free tools?

Need to encode a URL or longer text instead of a plain number? Use the QR code generator, which also lets you set the error correction level and checks color contrast before you print. To resize a downloaded barcode image for a layout, the image resizer handles that.

Notes

  • JAN-13 is Japan's domestic name for the same EAN-13 symbology — if you're following a Japanese source that says "JAN", it's this format
  • A real EAN-13/EAN-8 number requires a GS1-assigned company prefix; see above for what this tool is meant for instead
  • Code 128 accepts ASCII letters, digits and symbols only. GS1-128 (Code 128 with FNC1) isn't supported
  • All processing happens in your browser; nothing is uploaded

Frequently asked questions

What's the difference between EAN-13 and UPC-A?
EAN-13 is the 13-digit international retail barcode used almost everywhere outside North America. UPC-A, used in the US and Canada, is a 12-digit format that is functionally the same symbology read as a 13-digit EAN-13 with a leading 0. Of the retail formats, this tool generates EAN-13 (12 data digits plus a check digit) and EAN-8 (7 data digits plus a check digit); for letters and symbols, use Code 128.
Can I use a barcode I made here on a real retail product?
Only if the number itself is one you're licensed to use. The first digits of a real EAN-13 are a GS1 company prefix assigned to a specific business by a GS1 member organization (GS1 US, GS1 Japan, and so on); you can't invent one and expect it to work at a store's point of sale. This tool is meant for internal inventory tags, event badges, or any barcode that never has to match a real GS1 registration.
How is the check digit calculated?
With GS1's modulus-10, weight-3 formula: starting from the digit next to the check digit and moving left, multiply alternating digits by 3 and 1, add everything up, and subtract the result mod 10 from 10 (using 0 instead of 10). This tool calculates it automatically, and if you paste in a number that already includes a check digit, it verifies that digit instead of silently overwriting it.
Is Code 128 supported?
Yes. Choose Code 128 to encode ASCII letters, digits and symbols, such as an asset tag like ABC-001. A number made only of an even count of digits is packed two digits per symbol, so the barcode comes out narrower. GS1-128 (with FNC1) isn't supported.
Share this tool: