Barcode Generator
I wrote my first barcode generator in 2015. It drew EAN-13 codes out of hundreds of little div
elements, and it has not worked for a while. This is its replacement: it draws to a canvas, handles
the symbologies you meet in a shop, and knows what the digits inside a barcode mean.
What it makes
It makes EAN-13, EAN-8, UPC-A and UPC-E for products; GS1-128, ITF-14 and Interleaved 2 of 5 for cases and logistics; and Code 128, Code 39 and Codabar for everything else a store prints for itself. It checks what you type as you type it, works out check digits, and tells you when a supplied one is wrong. The highlights mark the check digits and the guard, start and stop patterns underneath the bars, where they do not stop a scanner from reading the result. Downloads come as SVG, sized in millimetres for printing, or as PNG.
Data inside the barcode
Plenty of retail barcodes are not just a number. An in-store code for loose produce carries an item and a price, a coupon carries a discount type and value, and a receipt carries a store, a register, a date and a transaction. A layout describes those fields, so the tool can build the barcode from them, color each one, and explain the result in words. These demonstrations are invented, but each one follows a common pattern:
- A price-embedded item in the in-store EAN-13 range
- A weight-embedded item
- A logistics label with a GTIN, an expiry date, a weight and a batch, as GS1-128
- A receipt lookup code in Interleaved 2 of 5
- A membership card in Codabar, with a Luhn check digit
- A store coupon with a discount type, a value and an expiry date
Reading a barcode back
The Read side works the other way round. Paste a scanned value and the tool tries every layout whose shape fits, splits the value into its fields, checks the check digits and dates, and says what it found. Even without a layout it recognizes a valid EAN-13 and names its GS1 prefix, and it lays out GS1 element strings with each Application Identifier named.
Your own layouts
You can write layouts of your own in JSON, either in the tool's editor or in a file you import. They are kept in your browser, or in Edge and Chrome in a file on your own disk that the tool writes to, and this site never sees them. That matters for anyone working with a retailer's own barcode formats, which are usually not public.
The barcode tool guide covers everything in detail, including the layout format with examples.