Barcode generator. Scannable in seconds.
Encoded in your browser, nothing is uploaded or stored.
Two real standards, encoded from scratch
Code 128 packs any ASCII text and auto-switches between code set B (text) and C (pairs of digits) for compact numeric runs, with the required modulo-103 check symbol. EAN-13 takes 12 digits, computes the modulo-10 check digit (or verifies it if you supply all 13), and lays out the left/right guard and centre patterns. The encoders are written in plain JavaScript right on this page, no library, no server.
How to use the Barcode Generator
This generator draws Code 128 and EAN-13 barcodes from text or digits you type. The encoders run in plain JavaScript on the page, add the check symbol or check digit for you, and leave a quiet zone of 10 modules on each side. Use it for shipping labels, internal stock codes and retail product barcodes.
Step by step
-
Choose the symbology
Open Symbology and pick Code 128 (text & numbers) for any text, SKUs or shipping codes, or EAN-13 (12-13 digits) for a retail product code. Code 128 is selected when the page opens.
-
Type the data
Enter your value in Data to encode. It starts as HELLO-123. Code 128 takes letters, digits, spaces and standard punctuation, ASCII codes 32 to 126. EAN-13 takes 12 digits, and the tool adds the check digit, or all 13 digits to have the last one verified. Spaces are ignored in EAN-13 mode.
-
Size the bars
Drag Bar width from 1 to 6 px (default 2) and Bar height from 30 to 220 px in steps of 10 (default 90). Bar width sets the width of the thinnest bar, so it scales the whole barcode and the text under it.
-
Set colors and text
Use Bar color (default a near black) and Background (default white) to match your label. Untick Show human-readable text to drop the line of characters printed under the bars.
-
Export the barcode
Press Download PNG for an image at the pixel size the preview is drawn at, Download SVG for a file that scales to any size, or Copy SVG markup to paste the code into a design tool. Files are named after the symbology and your data, for example code128-HELLO-123.png.
Reading the result
- The line under the data field confirms what was encoded. For the default HELLO-123 it reads 9 characters encoded.
- In EAN-13 mode it shows the full code and its check digit. Typing 590123412345 gives Encodes as: 5901234123457 (check digit 7).
- If you type 13 digits and the last one is wrong, the line turns orange and tells you which check digit the first 12 digits need, and the preview goes blank until it is fixed.
- An orange message also appears for letters in EAN-13, a wrong number of digits, an empty field or characters Code 128 cannot hold. The download and copy buttons show the same message instead of exporting.
Tips and common mistakes
- Keep dark bars on a light background. Scanners read contrast, and light bars on a dark background or pale colors often fail.
- For print, use the SVG. A PNG has a fixed pixel size, so raise Bar width before downloading if you need a larger PNG.
- Do not crop the white margin on either side of the bars. That quiet zone is part of the standard and scanners need it.
- In Code 128, runs of four or more digits are packed two per symbol, so a numeric code comes out shorter than the same number of letters.
- EAN-13 numbers for products you sell in stores are issued by GS1. Making up 12 digits gives a valid barcode, not a registered product number.
- Scan a test print with a phone or scanner before printing a full batch of labels.
Privacy and limits
The barcode is encoded and drawn by your browser. Nothing you type is uploaded or saved, so reloading the page resets everything. Copy SVG markup uses your browser's clipboard and falls back to an older copy method if the clipboard is not available.
Everything a barcode tool should do.
- Generate Code 128 barcodes from any standard ASCII text or number string, the encoder auto-switches code sets B and C for compact digit runs.
- Generate EAN-13 retail barcodes from 12 digits (the check digit is computed for you) or validate a full 13-digit code.
- Watch the live preview redraw on every keystroke, with an inline hint showing the check digit or character count.
- Adjust bar width (1 to 6 px) and bar height (30 to 220 px) with sliders to fit your exact label dimensions.
- Customise bar and background colors for print or on-screen use, and toggle the human-readable text below the bars.
- Export as lossless PNG or scalable SVG, or copy the SVG markup straight to your clipboard for design tools.
Frequently asked questions.
Is the Barcode Generator free?
Is it private? Is my data uploaded anywhere?
What is the difference between Code 128 and EAN-13?
How is the EAN-13 check digit handled?
Should I download PNG or SVG?
Will these barcodes actually scan?
Published · Last updated .