Barcode and QR code generator
Make a QR code, EAN-13, UPC-A, Code 128, ITF-14 or Data Matrix barcode, download it as SVG or PNG, or read a code from an image.
Code examples
Copy and paste these into your own project. Each one uses only the language's standard library, so there is nothing to install.
const body = '590123412345'
const sum = [...body].reduce((total, digit, i) => total + Number(digit) * (i % 2 === 0 ? 1 : 3), 0)
console.log(body + ((10 - (sum % 10)) % 10))What it does
Draws a QR code, EAN-13, EAN-8, UPC-A, Code 128, ITF-14 or Data Matrix from the text you type, and downloads it as SVG or PNG. Digit codes get their check digit added, and a wrong one is explained instead of drawn. In browsers that support it, it can also read a code from an image.
How to use it
- Pick a code type and type the content, or pick an example.
- Check the preview. Raise the QR error-correction level if the code will be printed small or with a logo.
- Download the SVG for print or the PNG for screens, or read a code from an image.
Examples
https://codeknife.dev as a QR code opens the site when scanned. 590123412345 as EAN-13 becomes 5901234123457: the tool adds the check digit. Code 128 takes printable ASCII such as CODEKNIFE-2026.
Good to know
- EAN-13 has 13 digits, EAN-8 has 8, UPC-A has 12 and ITF-14 has 14; the last digit is a check digit. Type the digits without it and it is added; type all of them and a wrong check digit is refused.
- The drawn code is a picture, black on white with a margin, so it scans on a dark page too. SVG stays sharp at any size; PNG is a fixed size set by the size option.
- Reading a code from an image needs the browser’s Barcode Detection API, which not every browser has yet. Nothing is uploaded either way: the image is read on your device.
Which barcode should I use?
Use a QR code for links and text that people scan with a phone. Use EAN-13 or UPC-A for products sold in shops, ITF-14 for outer cartons and Code 128 for internal labels and shipping. Data Matrix suits very small marks. Digit codes get their check digit added for you, and a wrong one is refused.
Frequently asked questions
What does the error-correction level do?
A QR code carries spare data, so it still reads when part of it is dirty or covered. A higher level survives more damage but needs more dots for the same text. Medium is a good default; use High when you print a logo over the middle.
Is the code I make free to use?
Yes. The code is drawn in your browser and belongs to you, with no watermark. For retail EAN or UPC numbers you still need a company prefix from GS1, because the digits identify your product worldwide.
Does this tool send my input anywhere?
No. The code is drawn in your browser and what you type is never sent to our servers.