NinjaFunction (Ninja Function) logo

Barcode Generator & Reader

Generate barcodes in CODE128, EAN, UPC and more — download as PNG or PDF at exact page sizes, or scan barcodes with your camera.


Barcode Settings

Preview

PDF page will be exactly 80×40 mm. Everything runs in your browser — nothing is uploaded.

About This Tool

NinjaFunction's Barcode Generator & Reader lets you create barcodes in 10+ formats and download them as PNG images or PDFs with exact physical dimensions in mm, cm, or inches. Switch to Reader mode to scan barcodes from your camera or an uploaded image using ZXing WebAssembly. Everything runs locally — your data never leaves the browser.

📊 How to Use

  1. Choose the Generator tab to create a barcode.
  2. Enter your value and pick a format (CODE128, EAN13, etc.).
  3. Set the page width and height in mm, cm, or inches.
  4. Download as PNG or PDF at the exact size you specified.
  5. Or switch to the Reader tab to scan a barcode with your camera or an uploaded image.

💡 Pro Tips

  • ✔ Match Format to Data – EAN-13 and UPC need exactly 12–13 digits; CODE128 accepts any text. Using the wrong format will fail.
  • ✔ Set Real Page Sizes – For PDF export, use actual print dimensions in mm (e.g. 50×30 mm for a label) so the barcode prints at true scale.
  • ✔ Test Before Printing Bulk – Always scan a printed sample with 2–3 different phones or scanners before committing to a full print run.
  • ✔ Leave a Quiet Zone – Keep a blank margin of at least 10× the narrow bar width around the barcode so scanners can lock on reliably.
  • ✔ Camera Reader Uses Rear Lens – The scanner activates your device's back camera for better focus. Grant camera permission when prompted.
  • ✔ Copy with One Click – Use the 📋 Copy button to grab the decoded barcode value instantly.
  • ✔ Works Offline – Once loaded, generation and scanning run entirely in your browser — nothing is uploaded.

About Barcodes

Barcodes encode data as a pattern of parallel lines (1D) or a matrix of squares (2D). They are read by optical scanners and are used everywhere from retail checkout to inventory management and shipping labels.

CODE128

A high-density linear barcode that can encode all 128 ASCII characters. The most common general-purpose format.

EAN-13 / EAN-8

The standard retail barcode used worldwide on consumer products. EAN-13 encodes 13 digits, EAN-8 encodes 8.

UPC

The North American equivalent of EAN, used on retail products in the US and Canada.

Which Barcode Type Should You Use?

TypeHoldsCommon use
Code 128Letters, numbers and symbolsShipping, inventory and internal IDs
EAN-1313 digitsProducts sold in shops worldwide
UPC-A12 digitsProducts sold in North America
Code 39Capital letters and numbersAsset tags and older systems
ITF-1414 digitsCartons and cases

Getting a Barcode That Scans

  • Print dark bars on a plain white background with a quiet blank margin on both sides.
  • Do not stretch or shrink the barcode in a design program. Keep the proportions.
  • Print at the exact size you set, with scaling turned off.
  • Test with a phone or a scanner before printing in bulk.

Barcode or QR Code?

A barcode is best for short numbers or codes that a scanner reads at a till or a warehouse door. A QR code holds much more, such as a web address or contact details, and can be scanned by any phone camera. For a product on a shelf use a barcode. For a poster or a menu use a QR code.

FAQ

Are barcodes free to generate?

Yes — this tool is completely free. The barcode formats themselves (CODE128, EAN, UPC, etc.) are open standards.

Can I use generated barcodes commercially?

Yes. However, if you need a retail barcode (EAN/UPC), you must obtain a GTIN from GS1 — the barcode itself is just the encoding.

Is my data safe?

Yes — everything runs locally in your browser using WebAssembly and the Canvas API. No barcode value, image, or camera feed is ever uploaded to a server.

Which barcode format should I choose?

Use CODE128 for most internal labels, because it holds letters, numbers and symbols in a short code. Use EAN-13 or UPC for products sold in shops, with a number issued by GS1. CODE39 suits older industrial scanners, ITF is used on shipping cartons, Codabar appears in libraries and blood banks, MSI on shelf labels and Pharmacode on medicine packaging.

Why does the tool say my input is invalid?

Each format only accepts certain characters and lengths. EAN-13 needs 12 digits (the tool adds the check digit) or 13 digits with a correct check digit, EAN-8 needs 7 or 8 digits, and UPC needs 11 or 12 digits. CODE39 accepts capital letters, digits, spaces and the symbols - . $ / + %. If you are not sure, switch to CODE128.

Can I scan a barcode with my camera?

Yes. The reader can use your device camera or an image you choose. Decoding happens in your browser, so the camera feed and the image never leave your device.

Always FreeAll tools are 100% free to use.
No Sign UpNo registration or login required.
Blazing FastInstant results, always.