Skip to main content
BG

Barcode Generator

Generate scannable Code 128, EAN-13, or UPC-A barcodes from text or digits, right in your browser.

Did you like the tool? Thanks!
Share:

More Generators Tools

CC

Currency Converter

Convert between world currencies using live exchange rates — fast, accurate, and free.

PG

Password Generator

Generate strong, random passwords with full control over length and character types — created securely in your browser, never sent anywhere.

PS

Password Strength Checker

Check how strong your password really is — instant entropy score, estimated crack time, and specific weaknesses, analyzed entirely on your device.

UG

Username Generator

Generate creative, memorable usernames from an optional keyword — playful or professional, with optional numbers and separators.

BN

Business Name Generator

Generate creative business name ideas from a keyword or industry — prefix, suffix and blended-name combinations, ten ideas at a time.

IB

ISBN Barcode Generator

Turn a 10 or 13-digit ISBN into a scannable EAN-13 barcode, with automatic ISBN-10-to-13 conversion and checksum validation.

MT

Meme Text Generator

Add classic bold white-on-black top and bottom captions to any image or a blank canvas, then download as PNG.

ES

Email Signature Generator

Build a clean, professional HTML email signature with your name, title, photo and social links — then copy it straight into Gmail or Outlook.

ET

Email Template Builder

Stack headings, paragraphs, buttons, images, dividers and spacers into a ready-to-send HTML email — no drag-and-drop plugin required.

EP

Emoji Picker

Search or browse 250+ emoji by category, click to copy, and quickly reuse your recently picked ones.

A 20px quiet zone is kept on each side of the bars so real-world scanners can read the barcode reliably.

How to Use Barcode Generator

Pick a format, type your text or digits, and get an instant barcode rendered on a canvas with the human-readable code shown underneath. EAN-13 and UPC-A automatically calculate the check digit for you when you leave it out, and verify it when you include it. Download the finished barcode as a PNG with one click.

About Barcode Generator

A barcode packs a short string of digits or text into a pattern of black bars and white spaces that a laser or camera scanner can read in a fraction of a second, without anyone needing to type it by hand. Different industries settled on different barcode symbologies (encoding standards) over the decades, and this tool covers the three a small business, hobby project, or student assignment is most likely to need: Code 128, EAN-13, and UPC-A. Code 128 is the most flexible of the three — it can encode any printable ASCII text, not just digits, which makes it the natural choice for shipping labels, internal inventory codes, ticket numbers, or any alphanumeric identifier a point-of-sale scanner needs to read back exactly as typed. This tool implements Code 128 Subset B, the variant built for readable mixed-case text and punctuation, as opposed to Subset C (which packs pairs of digits more densely) or Subset A (aimed at control characters). EAN-13 and UPC-A, by contrast, are strictly numeric retail barcodes — the ones printed on nearly every packaged product sold in a shop. EAN-13 (European Article Number, despite the name now used worldwide) encodes 13 digits; UPC-A (Universal Product Code), the older North American standard, encodes 12. The two are close relatives: a UPC-A code is mathematically identical to an EAN-13 code with an invisible leading zero, which is why an EAN-13 scanner at a checkout can read a UPC-A product without any special handling, and why this tool reuses the exact same encoding tables for both formats. Both EAN-13 and UPC-A end with a check digit — a single digit mathematically derived from every digit before it, using an alternating-weight checksum. Its only job is error detection: if a digit gets mistyped, smudged in print, or misread by a scanner, the check digit almost certainly won't match, so the scanning system can reject the read and ask for another pass rather than silently recording the wrong product. This tool calculates that check digit automatically when you type a 12-digit EAN-13 body (or an 11-digit UPC-A body), and verifies it for you when you type the full code including your own check digit, telling you exactly what value it expected if there's a mismatch. Everything — encoding, checksum calculation, and the canvas drawing itself — runs directly in your browser using plain JavaScript. No text or number you type is ever uploaded anywhere; the finished barcode exists only as pixels on your own screen until you explicitly choose to download it as a PNG.

Details & Tips

Code 128 (Subset B) encoding: each character from space (ASCII 32) through ~ (ASCII 126) maps to a value from 0 to 94 (value = character code − 32). The barcode always starts with the Start B pattern, followed by one bar/space pattern per character, a checksum pattern, and the Stop pattern. The checksum is (104 + Σ(value[i] × (i+1))) mod 103, where 104 is the Start B symbol's own value and i is the 1-indexed position of each data character — so the first character is weighted ×1, the second ×2, and so on. Characters outside the space–~ range are rejected with an error, since Subset B has no pattern defined for them. Worked example: encoding "HELLO" gives character values 40, 37, 44, 44, 47 (for H, E, L, L, O), a checksum of 40, and a total barcode length of 90 modules (11 for Start B, 11 × 5 for the five data characters, 11 for the checksum, 13 for the wider Stop pattern). EAN-13 / UPC-A encoding: the first digit of an EAN-13 code selects one of ten left-hand encoding patterns — a mix of two digit-encoding tables, L and G — that the next six digits are drawn from; the final six digits always use a third table, R. A UPC-A code is treated internally as an EAN-13 code with an implied leading 0, which is why UPC-A's visible digits always use the same left-hand pattern as an EAN-13 code starting with 0. The check digit is calculated by giving alternating weights of 1 and 3 to the 12 digits before it, starting with weight 1 on the first digit, summing the results, and taking (10 − (sum mod 10)) mod 10. Worked example: the 12-digit body 400638133393 produces check digit 1, giving the full, valid, real-world EAN-13 code 4006381333931. Edge cases: an EAN-13 or UPC-A entry with the wrong digit count shows a clear "enter N digits" message rather than guessing at intent. A code with the right digit count but a check digit that doesn't match the one this tool calculates is flagged with the expected value, so a typo is easy to spot and fix. A blank Code 128 input simply shows a neutral placeholder rather than an error, since an empty box isn't a mistake — there's just nothing to encode yet. A 20px quiet zone (blank margin) is kept on both sides of every generated barcode, matching the minimum real-world scanners expect; a barcode printed without this margin can fail to scan reliably even when the bars themselves are perfectly correct.

Frequently Asked Questions

What is the difference between Code 128, EAN-13, and UPC-A?
Code 128 can encode any printable text (letters, numbers, punctuation), making it suited to labels and internal codes. EAN-13 and UPC-A are strictly numeric retail barcodes — EAN-13 encodes 13 digits and is used worldwide, UPC-A encodes 12 digits and is the older North American standard. A UPC-A code is really an EAN-13 code with an invisible leading zero.
Do I need to calculate the check digit myself for EAN-13 or UPC-A?
No. If you type a 12-digit EAN-13 body or an 11-digit UPC-A body, the check digit is calculated and appended automatically. If you already know your check digit, type the full 13 or 12 digit code and the tool verifies it matches.
Can Code 128 encode letters and symbols, not just numbers?
Yes. This tool implements Code 128 Subset B, which supports any printable ASCII character from space through ~ (tilde), including uppercase and lowercase letters, digits, and common punctuation.
Why did I get an "Invalid EAN-13" or "Invalid UPC-A" error?
This appears when you type the full code including your own check digit, but that digit does not match the one calculated from the rest of the number. The error message shows the expected check digit so you can spot the typo.
What happens if I enter the wrong number of digits?
EAN-13 requires 12 or 13 digits and UPC-A requires 11 or 12 digits; anything else shows a clear message telling you how many digits are needed rather than attempting a barcode from an invalid length.
Is my data uploaded anywhere when I generate a barcode?
No. Encoding, checksum calculation, and the canvas rendering all happen locally in your browser using JavaScript. Nothing you type is sent to a server.
Can I use these barcodes on real product packaging?
The EAN-13 and UPC-A encoding tables and checksum formulas used here match the official standards, so the resulting barcodes are structurally correct. For commercial retail use you would also need a registered, unique product number (GS1 membership), which this free tool does not provide.
Why is there empty space on either side of the bars?
That is the quiet zone — a required blank margin (20px here) that real-world barcode scanners need in order to reliably detect where the barcode starts and ends. Removing it can cause scan failures even if the bars are otherwise correct.
What image format do I get when I download?
A PNG file, generated directly from the canvas using its native toBlob export, the same approach used by other image-generating tools on this site.
Can a standard retail scanner read a UPC-A barcode as EAN-13?
Yes. Because UPC-A is mathematically an EAN-13 code with a leading zero, EAN-13-capable scanners (which is effectively all modern retail scanners) read UPC-A barcodes without any special configuration.
Does the barcode update automatically as I type?
Yes, the canvas redraws on every keystroke and every time you change the format, so you always see a live preview that matches exactly what you would download.
Why does an empty text box show a placeholder instead of an error?
An empty input isn't treated as a mistake — for Code 128 in particular, the tool simply shows "Enter text to generate a barcode" until you type something, rather than displaying an alarming error for a box you haven't filled in yet.

Also Available As

barcode generator, code 128 generator, ean-13 generator, upc-a generator, make a barcode online, barcode maker, check digit calculator, scannable barcode

Found a Problem?

Let us know if something with Barcode Generator isn't working as expected.

Thanks — we'll take a look.