Project Nayuki

1D barcode generator (JavaScript)

Live application




This JavaScript program generates 1D (linear) barcodes for numerous standards. Note that some schemes have limitations, such as only encoding numbers, supporting a limited character set, and/or restricting lengths. You can save the generated barcode image by right-clicking on it.

The UPC and EAN schemes show the trailing check digit to the human. If you create the barcode in raw mode you can set the check digit to any value – but scanners will ignore barcodes with an incorrect check digit. Thus for convenience, you should use the program to automatically compute the check digit. Either way, the check digit cannot be used to store extra useful information, because its value is determined by all the preceding digits.

One-dimensional barcodes are suitable for conveying text data up to about 30 characters long, generally speaking. As the text length increases further, these barcodes become noticeably unwieldy and machines might have difficulty scanning them. Larger data should use two-dimensional barcodes such as QR Codes, which can easily handle hundreds of characters, remain reasonably compact and easy to scan, and have powerful error correction built in.

Use this barcode generator at your own risk. This program is complex and not easy to verify, thus Nayuki does not provide warranty or compensation for incorrectly generated barcodes. If you do discover a problem, contact me so I can investigate and fix it for future users. The source TypeScript code and compiled JavaScript code are available for viewing.

More information about the implemented barcode standards is available on Wikipedia: Codabar, Code 39, Code 93, Code 128, International Article Number (EAN), EAN-8, Interleaved 2 of 5, Universal Product Code.