How to Generate an EAN-13 Barcode in JavaScript

1 min readJun 15, 2021


While the UPC-A barcode is the standard across North America, the EAN-13 barcode is the most commonly used in Europe. This version contains 13 digits, and similar to the UPC-A format, it can be used internationally. In this brief tutorial, we will demonstrate how to automatically generate an EAN-13 barcode image using an API in JavaScript.

Our first step is to install the jQuery library:

bower install jquery

Next, we can call the function with the following code:

var settings = {
"url": "",
"method": "POST",
"timeout": 0,
"headers": {
"Content-Type": "application/x-www-form-urlencoded",
"data": {
"0": "<",
"1": "s",
"2": "t",
"3": "r",
"4": "i",
"5": "n",
"6": "g",
"7": ">"
$.ajax(settings).done(function (response) {

This will return a PNG file of the barcode that is downloadable and ready for use!




There’s an API for that. Cloudmersive is a leader in Highly Scalable Cloud APIs.

Recommended from Medium