API reference
GET https://barcodejar.com/api/barcode returns an image. Use /api/barcode.svg for SVG.
| Parameter | Default | Description |
|---|---|---|
data | required | The value to encode. URL-encode it. |
type | code128 | Barcode type: code128, upca, ean13, qrcode, datamatrix, gs1-128 and more. See all types. |
format | png | png or svg. |
scale | 3 | Pixels per module, 1–10. |
height | auto | Bar height in millimetres (1D barcodes). |
hrt | 1 | 0 hides the human-readable text. |
fg / bg | 000000 / ffffff | Hex colours without #. bg=transparent removes the background. |
padding | 8 | Quiet zone in modules, 0–50. |
rotate | N | N, R (90°), I (180°), L (270°). |
Examples
HTML
<img src="https://barcodejar.com/api/barcode?type=upca&data=012345678905" alt="UPC barcode 012345678905"> Google Sheets
=IMAGE("https://barcodejar.com/api/barcode?type=code128&data="&ENCODEURL(A2)) Markdown
 Please link to BarcodeJar if the API is useful to you. It keeps the service free.
Frequently asked questions
Is the barcode API really free?
Yes. There is no key, no sign-up and no watermark. Images are cached at the edge, so repeat requests are fast. Please be reasonable: if you need millions of images a day, generate them yourself with the open-source bwip-js library, which this API uses.
How do I make barcodes in Google Sheets?
Use the IMAGE function with the API URL and your cell value: =IMAGE("https://barcodejar.com/api/barcode?type=code128&data="&ENCODEURL(A2)). Fill it down the column to make a barcode for every row.
How do I make barcodes in Excel?
Excel 365 has an IMAGE function that works the same way: =IMAGE("https://barcodejar.com/api/barcode?type=code128&data="&ENCODEURL(A2)). For older Excel versions, use our bulk generator and insert the images.
Which barcode types are supported?
All 106 types that BarcodeJar supports, including Code 128, UPC-A, EAN-13, QR Code, Data Matrix, PDF417, GS1-128 and ITF-14. Pass the type with the type parameter, for example type=qrcode.
Can I get an SVG instead of a PNG?
Yes. Add &format=svg, or call /api/barcode.svg. SVG is a vector format, so it stays sharp at any print size.
What happens if my data is invalid?
The API returns HTTP 400 with a JSON body explaining the problem, for example {"error":"UPC-A must be 11 or 12 digits"}.