Open-Source Barcode Scanner SDK

Build local barcode scanning directly into your app. One open-source engine converts saved label images or live camera frames into exact identifier strings and symbologies across 1D and 2D barcodes plus QR codes.

import init, { scan_image } from
  "@qrcode-ai-com/qrcode-barcode-scanner-wasm";

await init();
const bytes = new Uint8Array(await file.arrayBuffer());
const report = scan_image(
  bytes, "frame", undefined, undefined, 1000
);
const barcode = report.detections
  .find(d => d.symbology === "code128");

console.log(barcode?.content.text);

Example outputSTOCK-4827

Scan a saved label

Pass encoded bytes from an upload, screenshot or label photo to scan_image. The Code 128 example outputs STOCK-4827 alongside other supported formats.

npm install @qrcode-ai-com/qrcode-barcode-scanner-wasm

Need to decode a barcode right now? Open online reader

From barcode labels to structured app data.

  • Linear and 2D barcodes

    1D + 2D

  • Saved images and camera frames

    Image + frame

  • SDK integration routes

    10

  • Open-source on-device engine

    MIT

A barcode reader SDK for your own software

One open-source MIT Rust engine decodes 16 linear and 2D barcode symbologies (plus QR codes) from saved images or camera frames, returning exact identifier strings alongside each detected format.

Barcode Scanner and QR Code Scanner share the identical 10 language packages. Just scanning one label now? Open the online Barcode Scanner.

Decode barcodes from saved images and camera frames

Accepts encoded image files and raw RGBA camera frames, leaving your app in full control of symbology filtering and downstream actions.

Scan a saved label

Pass encoded bytes from an upload, screenshot or label photo to scan_image. The Code 128 example outputs STOCK-4827 alongside other supported formats.

Scan live camera frames

Pass RGBA pixels to scan_frame or wire up the browser /camera controller. Your app owns camera permissions and lifecycle.

Parse the scan report

Read symbology (such as code128) and content.text strictly as strings so leading zeros survive downstream validation or lookup.

Pick your Barcode Scanner SDK package

Choose from 10 published SDK packages sharing one decoding engine and JSON report format, including browser JS/TS and Android Kotlin/Java.

Package or source
@qrcode-ai-com/qrcode-barcode-scanner-wasm
Installation
npm install @qrcode-ai-com/qrcode-barcode-scanner-wasm
Details
Published on npm with TypeScript definitions and mirrored on jsDelivr, unpkg and esm.sh. Bundles one portable WASM binary alongside /auto, /scan, /camera, /camera-overlay and /node entry points. Serve the WASM file alongside your app.
JavaScript barcode scanner guide

Package or source
@qrcode-ai-com/qrcode-barcode-scanner
Installation
npm install @qrcode-ai-com/qrcode-barcode-scanner
Details
Published on npm for Node.js 18+, shipping pre-built native binaries for macOS, Linux (GNU and musl) and Windows with TypeScript declarations. Built for server-side decoding.
Node.js barcode scanner guide

Package or source
qrcode-barcode-scanner on PyPI / import qrcode_barcode_scanner
Installation
pip install qrcode-barcode-scanner
Details
Published on PyPI for Python 3.8+, with pre-built wheels for macOS, Linux and Windows so no Rust compiler is required. scan and scan_frame return the scan report as a Python dict.
Python barcode scanner guide

Package or source
qr_barcode_scanner on pub.dev
Installation
flutter pub add qr_barcode_scanner
Details
Published under verified publisher qrcode-ai.com. Supports signed pre-compiled native binaries via cargokit or local builds with Rust and Android NDK r28+. Decodes saved images and raw RGBA camera frames.
Flutter barcode scanner guide

Package or source
qrcode-barcode-scanner on JitPack
Installation
implementation("com.github.qrcode-ai-com:qrcode-barcode-scanner:0.12.2")
Details
Distributed as an Android AAR on JitPack via one Gradle line, covering four Android ABIs with 16 KB memory-page alignment for 64-bit devices. scan returns ScanReport as a JSON string. Not published on Maven Central yet.
Android barcode scanner guide

Package or source
qrcode-barcode-scanner-swift on Swift Package Index
Installation
.package(url: "https://github.com/qrcode-ai-com/qrcode-barcode-scanner-swift.git", from: "0.12.2")
Details
Add via Swift Package Manager and link the QRCodeBarcodeScanner product. SwiftPM fetches the pre-built, checksum-verified XCFramework automatically with no Rust toolchain needed.
iOS barcode scanner guide

Package or source
QRCodeAI.QRCodeBarcodeScanner on NuGet
Installation
dotnet add package QRCodeAI.QRCodeBarcodeScanner
Details
Published on NuGet with pre-built native libraries spanning five desktop and server OS/architecture targets. Call Scanner.Scan for image bytes or Scanner.ScanFrame for RGBA frames.
.NET / C# barcode scanner guide

Packages and registries verified on 27 November 2026. Browse full cross-language guides in the GitBook SDK documentation and the open-source scanner repository, or try the browser build on GitHub Pages. Go and PHP wrap the local qrscan executable; the Barcode Scanner CLI has its own guide.

JavaScript quick start: decode a barcode in the browser

Plan label capture and output handling. Expand the snippet below for exact code and install commands.

Plan capture, loading and result controls

Your app owns the file picker or camera stream, loading state and output controls. Initialise WASM once and run synchronous scans inside a Web Worker; for live cameras, capture RGBA frames and provide explicit stop controls.

Store every decoded identifier strictly as a string so leading zeros never drop. Clear stale output after empty scans and handle decode exceptions separately.

Follow the JavaScript barcode scanner guide for full browser integration steps.

Need a quick test label? Create a barcode with Barcode Generator using Code 128 and STOCK-4827, export it as PNG and check the decoded text matches.

Decode a selected barcode image

Install the browser package

Pick your preferred package manager. Each command installs the identical MIT-licensed WebAssembly package from npm.

Before adding the library to a project, review its open-source licensing guide. To test it online first, launch the Vite starter on StackBlitz, which installs this package and scans locally in your browser.

npm install @qrcode-ai-com/qrcode-barcode-scanner-wasm

Decode a selected barcode image

Initialise the WASM module once, then pass a browser File to readBarcodeImage. It keeps Code 128, Code 39, EAN-13, EAN-8, UPC-A, UPC-E, ITF and Data Matrix detections, returning exact symbology and text pairs or an empty array if none match. To allow more formats, append their identifiers to barcodeFormats: pdf417, aztec, maxi_code, code93, codabar, data_bar, data_bar_expanded or telepen. Check the ScanReport specification for all identifiers.

JavaScript
import init, { scan_image } from "@qrcode-ai-com/qrcode-barcode-scanner-wasm";

await init();

const barcodeFormats = new Set([
  "code128", "code39", "ean13", "ean8",
  "upc_a", "upc_e", "itf", "data_matrix"
]);

export async function readBarcodeImage(file) {
  const bytes = new Uint8Array(await file.arrayBuffer());
  const report = scan_image(bytes, "frame", undefined, undefined, 1000);

  return report.detections
    .filter((detection) => barcodeFormats.has(detection.symbology))
    .map((detection) => ({
      symbology: detection.symbology,
      text: detection.content.text
    }));
}

The second parameter picks the profile: "frame" decodes only, while "full" and "fast" also score the first code in the report.

Both undefined arguments keep the engine’s default size limits used in the browser demo: 10,000 px per side and 64,000,000 pixels, comfortably covering a typical mobile phone photo up to 48 megapixels. Larger images fail with input error QRS-002 or QRS-003 without resizing. On public-facing servers, set tighter bounds such as the documented 4,096 px and 16,000,000 pixels.

The 1,000 ms work budget is a cap rather than a latency guarantee because image decoding runs before that timer starts. Keep synchronous WASM scans inside a Web Worker to keep the UI smooth.

Example output

For a Code 128 label storing STOCK-4827, the function returns:

JSON
[
  { "symbology": "code128", "text": "STOCK-4827" }
]

What your app gets back from a barcode

A stock label and a retail identifier show how decoded strings map cleanly into application data.

A Code 128 label next to an app result card displaying content.text STOCK-4827 and symbology code128.

Keep stock references intact

The Code 128 label returns STOCK-4827 with symbology code128. Preserve both fields so your app can verify the symbology and query your inventory or asset system.

An EAN-13 barcode next to an app result card displaying content.text 1234567890128 and symbology ean13.

Store retail identifiers strictly as strings

EAN-13 returns 1234567890128 while UPC-A keeps leading zeros such as 012345678905. Keep every value as text before querying your product catalogue.

How to add barcode decoding to your app

Install your runtime’s package, pass a crisp label image or frame and keep every decoded character intact.

  1. Step 1

    Install and initialise the right package

    Add the package matching your web, server or mobile stack. In browsers, initialise WASM once client-side when scanning begins.

  2. Step 2

    Pass a label file or camera frame

    Call scan_image on encoded bytes or scan_frame on RGBA pixels with the full barcode and quiet zone clearly framed.

  3. Step 3

    Handle strings, empty runs and errors

    Preserve symbology and exact digits (including leading zeros), clear stale state on empty runs and handle errors separately.

Understand the barcode scan report

Drive business logic from the detected symbology and string value; parsed identifiers and quality diagnostics cover separate scopes.

Fields
detections[].symbology · content.text · content.raw
Meaning
Each detection captures its symbology (such as code128, ean13, upc_a or data_matrix) alongside decoded text. Always keep content.text as a string and check content.raw whenever exact byte handling matters.

Field
detections[].payload
Meaning
The engine can parse structured content including GS1 elements used across retail and logistics labels. Keep the raw string alongside parsed data: a GTIN or SKU never supplies a product name, price or stock level without querying a separate database.

Fields
score · hints · trace.budget_exhausted
Meaning
The frame profile omits scoring and returns score null. Full and fast score the first code in the report, estimating readability margin; on mixed images, QR codes list first so the score applies to the QR code. Scores are software aids rather than label print grades, so never treat null as zero or cite them as hardware certification.

Empty result
A valid report can hold zero detections, and the quick-start helper also returns [] if every detection falls outside its eight-format filter (including QR codes). Clear stale UI output and invite a clearer label.
Error
Invalid files (non-image inputs or oversized dimensions), initialisation failures and scan exceptions follow your installed package’s error contract. Catch them cleanly and show an actionable retry.

See the ScanReport specification for every field and null rule. All 10 language bindings return the identical JSON structure.

Compare browser barcode scanner libraries

Compare QR Code AI against other browser decoders across 1D labels, Data Matrix and built-in camera helpers; product lookup stays in your app.

Browser APIs · versioned sources · QR Code AI column updated 27 November 2026
CapabilityQR Code AIWASM · MITZXing Browser@zxing/browserQuagga2@ericblade/quagga2html5-qrcodehtml5-qrcode

Barcode formats

1D + 2D

Select the matching ZXing reader class: the multi-format reader covers 1D and 2D formats alongside a dedicated Data Matrix reader, depending on reader choice.

Built-in 1D

Cited built-in readers cover Code 128, EAN, UPC, Code 39 and other linear symbologies; third-party reader plugins sit outside this table.

1D + Data Matrix

Cited format support lists Code 128, EAN, UPC and Data Matrix among others; enabled symbologies and backend settings must match your target labels.

Data Matrix

Data Matrix

BrowserDatamatrixCodeReader and the multi-format reader document Data Matrix decoding, an advantage for 2D labels over built-in 1D-only readers.

Built-in 1D

Quagga2’s cited built-in reader set focuses on linear barcodes; this comparison excludes external plugins and makes no claim about third-party extensions.

Data Matrix

Data Matrix appears in the cited supported-format list, an advantage for 2D labels over built-in 1D-only readers; check your active backend and format options.

Image input

Image sources

ZXing Browser exposes image-element, image-URL and canvas decoding methods using a reader matching your target formats.

Image callback

Quagga.decodeSingle processes a saved image and reports results through a callback; input sizing and decoder config still apply.

Local File

Html5Qrcode.scanFile and scanFileV2 decode a local File directly, separate from the optional turnkey camera UI.

Camera controls

Capture / stop

Provides browser capture helpers and stop controls to cut down camera lifecycle wiring; user permission and UI flow still belong to your app.

Start / stop

Quagga.start() begins video decoding and Quagga.stop() halts scanning and releases the active camera stream.

Start / stop

The lower-level Html5Qrcode API handles camera scanning while Html5QrcodeScanner adds an optional ready-made UI; camera permission still applies.

Returned data

Text + metadata

Outputs decoded text, symbology format, corner points and format-specific metadata.

Text + location

Documented output includes codeResult.code, format and localisation/decoder metadata. Always preserve identifiers as strings.

Text + format

The callback passes decoded text alongside a result object identifying the detected format.

Green ticks mark documented Data Matrix support, an advantage over the cited Quagga2 built-in 1D readers; plain text is neutral, including the camera helpers documented by all four libraries. Open underlined labels for details. The cited html5-qrcode revision states maintenance mode. This table is not a speed, accuracy or print-quality benchmark.

Sources: QR Code AI browser WASM API, ScanReport specification, ZXing Browser README, ZXing supported formats list, Quagga2 README, html5-qrcode README and html5-qrcode API docs

Barcode Scanner SDK questions

SDK catalogue, barcode strings, camera frames, offline decoding and licence.

The Barcode Scanner SDK is an open-source MIT library developers embed inside their own software to decode barcode images and live camera frames into structured data. Your app supplies file inputs or cameras, UI and follow-up actions. For quick one-off scanning without coding, use the online Barcode Scanner.

The Barcode SDK catalogue covers 10 published languages and runtimes: browser JavaScript/TypeScript, Node.js, Rust, Python, Flutter/Dart, Android (Kotlin/Java), iOS (Swift), .NET/C#, Go and PHP. JavaScript and TypeScript share one WebAssembly package, while the CLI ships separately. Every integration has its own setup guide.

Yes. The browser package provides scan_image for encoded bytes and scan_frame for raw RGBA pixels with width and height, while /camera and /camera-overlay add a capture controller and live overlay. Your app still requests camera permission and decides when to stop streaming.

The JavaScript quick start filters for Code 128, Code 39, EAN-13, EAN-8, UPC-A, UPC-E, ITF and Data Matrix. ITF-14 reports as itf, GS1-128 reports as code128 and ISBN codes carried in EAN-13 report as ean13 rather than separate decoder names. The engine also decodes Code 93, Codabar, GS1 DataBar, GS1 DataBar Expanded, Telepen, PDF417, Aztec and MaxiCode plus QR Code, Micro QR and rMQR.

It returns a ScanReport carrying each detection’s symbology, content.text, content.raw, recognised structured payloads and trace metadata. The JavaScript quick start maps these to format and text pairs such as code128 and STOCK-4827. Store every identifier strictly as text including leading zeros; parsed GS1 payloads add structure without looking up retail product records.

Yes. After loading, the browser WASM build decodes offline on-device with no QR Code AI account or cloud call. Native packages for Rust, Node.js, Python, .NET, Android, iOS and Flutter execute directly where your app runs. Because your surrounding app manages uploads, storage and catalogue lookups, local decoding itself is not a blanket privacy or offline guarantee.

Yes. Current engine releases and language bindings use the permissive MIT licence, letting you embed, modify and ship them in open-source or commercial software while preserving copyright and licence notices. Check the open-source licensing guide for retained third-party notices and older release terms.

No. Local SDK decoding needs neither a QR Code AI API key nor generation credits and stays separate from the managed creation service. On that platform, free creation limits and Premium apply to affected creation features, and the seven-day Premium trial starts upon creating the first dynamic QR code or Smart Link rather than a barcode. Directly encoded barcode data never expires, though decoding cannot revive an offline managed destination.

Handle an empty detections array as a normal scan result rather than an exception; the quick-start helper also returns [] when filtering out other symbologies such as QR codes. Clear stale output, prompt for a clearer image showing the full barcode and quiet zone, and handle invalid inputs or initialisation errors separately. Decoding never certifies printed-label quality.

Yes. Barcode Scanner and QR Code Scanner share the exact same packages published under the QR Code & Barcode Scanner engine, so one install decodes both barcodes and QR codes even inside the same image. This page focuses on barcode workflows; check the QR Code Scanner SDK for QR examples and quality diagnostics.