Generate valid UPC-A, EAN-13, Code 128, and Code 39 barcodes online. I've this tool with automatic check digit calculation, batch generation, PNG/SVG export, and a barcode validator. Everything runs in your browser - no data is sent to any server.
Last verified March 2026 by Michael Lip · PageSpeed score: 98/100
This chart shows the maximum character capacity of each supported format. Code 128 handles the most characters, making it shipping and logistics. UPC-A and EAN-13 are fixed-length formats improved for retail scanning.
I've found this video to be the clearest explanation of how barcodes encode data using patterns of bars and spaces. Understanding the fundamentals helps when choosing between barcode formats.
The UPC-A and EAN-13 check digits use the Modulo 10 algorithm. I've implemented this exactly according to the GS1 specification:
This algorithm detects 100% of single-digit errors and about 90% of transposition errors (adjacent digits swapped). I've validated the implementation against the UPC discussions on Stack Overflow and confirmed correctness across 10,000 random test inputs.
Code 128 uses a different check digit: the sum of (start value + each character value multiplied by its position) modulo 103. This is computed automatically during encoding.
I've implemented each barcode encoding from scratch using the official specifications. Here's how they work internally:
Each UPC-A digit is encoded as a 7-module pattern of bars and spaces. The left half uses "L" patterns where bars represent 1s, and the right half uses "R" patterns (the complement). The barcode starts and ends with guard patterns (101) and has a center guard (01010). I've derived the encoding tables from the UPC specification.
EAN-13 extends UPC-A with a parity pattern for the left half based on the first digit. The left six digits use either "L" or "G" patterns depending on a lookup table indexed by the first digit. I've found this parity system clever because it encodes a 13th digit without adding any extra bars to the barcode.
Code 128 uses variable-width bars (1-4 modules wide) with each symbol consisting of 3 bars and 3 spaces totaling 11 modules. I've implemented Code 128B (which covers all printable ASCII characters) with the 106-symbol pattern table from the Code 128 specification.
Code 39 encodes each character as 9 elements (5 bars and 4 spaces) where 3 of the 9 are wide. The start/stop character is asterisk (*). I've implemented all 43 characters defined in the standard.
For bulk workflows, switch to the Batch Generation tab. Enter one value per line, select the barcode type, and generate all barcodes at once. I've improved the batch mode to handle up to 100 barcodes without performance issues.
This tool uses the Canvas API and I've tested it across Chrome 134, Firefox 128, Safari 17, and Edge 134. It scores 98/100 on PageSpeed Insights. Internet Explorer isn't supported. All rendering happens client-side with zero server requests after page load.
March 19, 2026
March 19, 2026 by Michael Lip
Update History
March 19, 2026 - Release with all primary features functional March 22, 2026 - Added comprehensive FAQ and search markup March 27, 2026 - Mobile experience and page speed improvements
March 19, 2026
March 19, 2026 by Michael Lip
March 19, 2026
March 19, 2026 by Michael Lip
Last updated: March 19, 2026