Barcode Scanner CLI

Decode barcode label images inside your shell scripts and CI checks. Preserve every full identifier together with its detected symbology.

  • Homebrew

    CLI distribution

    Check install command
  • Scoop

    CLI distribution

    Check install command
  • Cargo

    CLI distribution

    Check install command

Barcode Scanner CLI at a glance

  • Runs locally, no cloud upload

    Single binary

  • Supported platforms

    macOS, Linux, Windows

  • Scan report format

    JSON

  • Open-source licence

    MIT

Install qrscan and decode your first barcode image

Barcode Scanner CLI is QR Code AI’s open-source command-line tool for reading barcode images. It installs a single binary, qrscan, for macOS, Linux and Windows. It converts an image file into structured decoded data without needing a browser: your script calls qrscan, reads the JSON output and branches on the shell exit code.

Install the CLI

Pick the installation method for your OS. Every channel installs the same qrscan binary.

brew install qrcode-ai-com/tap/qrscan

The distribution guide also covers Debian and Ubuntu .deb packages, Fedora RPMs, static musl binaries, the Arch Linux AUR package, an AppImage, Termux TUR and checksum-verified release archives.

The same qrscan binary decodes QR codes as well: check the QR Code Scanner CLI guide.

Test with the public sample image

Begin with a publicly hosted file: an EAN-13 sample stored in the scanner repository. The first command downloads it as ean13.png, while the second decodes it and filters the first detection using jq. Setting --budget-ms 0 removes the time limit for reproducible output.

Shell
curl -fsSL -o ean13.png \
  https://raw.githubusercontent.com/qrcode-ai-com/qrcode-barcode-scanner-rust/main/fixtures/symbology/ean13.png
qrscan ean13.png --budget-ms 0 | jq '.detections[0] | {symbology, content, payload}'

This snippet requires jq, a command-line JSON processor.

The commands above are written for bash or zsh.

Expected output

The first detection returned in that report looks like this:

JSON
{
  "symbology": "ean13",
  "content": {
    "text": "9506000134352",
    "raw": "OTUwNjAwMDEzNDM1Mg==",
    "charset": "utf8"
  },
  "payload": {
    "kind": "gs1",
    "elements": [
      {
        "ai": "01",
        "value": "09506000134352"
      }
    ],
    "gtin": "09506000134352",
    "conformant": true,
    "issues": []
  }
}

Here symbology identifies the detected barcode format, content.text holds the exact encoded digits and payload gives the parsed GS1 representation: Application Identifier 01 ("ai": "01") containing the same code as a 14-digit GTIN with its leading zero intact.

The scanner’s published sample report shows the exact same detection structure.

See the CLI reference for a full list of flags, output formats and exit codes.

Scan your own image file

Supply the path to your own label image, such as inventory-label.png. qrscan prints the scan report in JSON and returns an exit code. For a Code 128 label encoding STOCK-4827, the report captures both that string and its symbology.

qrscan "inventory-label.png" --profile fast

qrscan provides three profiles: full (the default) calculates a full-depth scannability score for the first detected code, fast calculates a lighter score and frame skips scoring to decode only. The “JSON report” example specifies fast, whereas “Decoded text only” leaves --profile unset and defaults to full.

detections[0] points to the first entry in the report. When a label image also contains a QR code, QR codes appear first in the array, so filter by symbology instead, such as jq -r '.detections[] | select(.symbology == "code128") | .content.text'.

To generate a test file yourself, create a test barcode with Barcode Generator using Code 128 and STOCK-4827, save the PNG as inventory-label.png and pass it to qrscan.

In a shell pipeline, the exit status reflects jq rather than qrscan: to act on the scanner’s exit code reliably, save the JSON report to a file first and inspect the status, or enable set -o pipefail.

Installation channels for Barcode Scanner CLI

The snippets above show Homebrew, Scoop and Cargo. Below are all official distribution channels grouped by platform; each installs the exact same qrscan binary.

Homebrew

Install qrscan on macOS or Linux via the QR Code AI Homebrew tap. Track the installed release version whenever a barcode script moves into scheduled batch jobs.

Scoop (Windows)

On Windows x64, install qrscan through the QR Code AI Scoop bucket. Double-check path quoting in PowerShell or Command Prompt when processing label files with spaces.

Linux packages and musl binaries

Fetch Debian and Ubuntu .deb packages, Fedora .rpm builds, static Linux musl binaries and checksum-verified archives straight from GitHub Releases.

Arch Linux AUR

Install the prebuilt qrcode-barcode-scanner-bin package on Arch Linux and related distros, with release tracking published on Repology.

AppImage and Termux

Execute the standalone AppImage on GNU/Linux without a system install, or install qrscan inside Termux on Android via the Termux User Repository.

Cargo (crates.io)

Compile and install qrscan straight from crates.io using Cargo. Opt for a language SDK guide if your app requires an embedded in-process barcode library.

How to decode a barcode image using qrscan

Install qrscan, supply a label image and verify both the JSON output and exit code before updating downstream systems.

  1. Step 1

    Install qrscan and select your input

    Set up qrscan via Homebrew, Scoop, Cargo or a release download. It processes only the image file you pass and never accesses a camera or USB reader.

  2. Step 2

    Inspect the JSON report and exit code

    Run qrscan on the image and check stdout JSON along with the exit code: 0 for decoded, 1 for a valid empty scan, 2 for invalid input or usage.

  3. Step 3

    Pass decoded data to your script

    Extract content.text and symbology as strings so leading zeros remain intact. Keep catalogue lookups and inventory updates as separate steps.

Decoded barcode output: Code 128 and EAN-13 examples

qrscan outputs each detection’s content.text and symbology (such as STOCK-4827 as Code 128 or 9506000134352 as EAN-13) without running a product lookup.

A saved Code 128 barcode image passes through a terminal workflow to output the decoded value STOCK-4827.

Decode STOCK-4827 from inventory-label.png

On inventory-label.png, qrscan returns STOCK-4827 (Code 128). Keep every character and leading zero intact, then query your own inventory database.

Supported barcode symbologies, profiles and exit codes

Profiles, output and exit codes. qrscan runs full by default, with fast and frame alternatives alongside --pretty and --score-only. Branch your scripts on exit codes (0 decoded, 1 empty scan, 2 input error, 3 timeout on --score-only); QR codes appear before barcodes on mixed images, and quality scores serve as software diagnostics rather than formal print grades.

Symbologies and CI budgets. One binary decodes 16 barcode formats (Code 128, EAN/UPC, ITF, Data Matrix, PDF417, Aztec, MaxiCode and others; GS1-128 maps to code128, ITF-14 to itf and ISBN to ean13) plus QR codes. Default budgets are 4,000, 800 and 80 ms; pass --budget-ms 0 in CI. See the agent integration guides.

Documentation and open-source licence. Consult the CLI reference for every flag and visit the scanner repository for the codebase, changelog and MIT licence.

CLI, Docker, MCP server, skill or SDK: which barcode scanner tool fits your workflow?

Use the CLI for shell scripts and CI pipelines. For other setups, pick the relevant guide below.

Barcode Scanner

Scan a single code immediately in your browser with zero installation.

Open the barcode reader

Barcode Scanner Docker

Keep an identical scanner environment across developer laptops and CI runners.

Explore Barcode Scanner Docker

Barcode Scanner Skills

Supply an AI agent with a consistent step-by-step image scanning workflow.

Explore Barcode Scanner Skills

Barcode Scanner SDK

Embed local scanning directly inside your app in your chosen language.

Explore the scanner SDK

Barcode Scanner CLI questions

Setup, supported image files, empty scans, safety and licensing.

A barcode scanner CLI is a command-line utility that decodes barcodes inside an image file and prints their values. QR Code AI provides the open-source qrscan command: your script passes an image path, parses a JSON report listing every value and symbology (such as Code 128 or EAN-13) and inspects the exit code. It differs from a browser tool, a live camera app and an in-process SDK.

Install qrscan for your platform. On macOS or Linux, execute brew install qrcode-ai-com/tap/qrscan. On Windows, add the QR Code AI Scoop bucket and install qrcode-barcode-scanner. If you use Rust, run cargo install --locked qrcode-barcode-scanner-cli. Once installed, call qrscan followed by your image file path.

Yes. qrscan works solely on the image file you specify and never opens a camera. Supported formats include PNG, JPEG, WebP and GIF. PDF documents, live webcam feeds and USB hardware scanners are outside its scope, so capture or export an image file first.

Check both the exit code and the JSON output. Exit 1 denotes a valid scan with no detections, whereas exit 2 signals invalid input or command usage. Treat an empty scan as conclusive only when trace.budget_exhausted is false; if the time budget expired early, rerun with --budget-ms 0.

No. qrscan treats decoded values strictly as plain data and never launches URLs or executes decoded text. Keep opening links or running commands as separate explicit logic in your script, and never interpolate decoded values or user-supplied filenames straight into a shell command.

They all rely on the same scanning engine and JSON report format, but fit different integration patterns: the CLI executes as a standalone process, an SDK runs directly inside your application code and the Docker image bundles qrscan together with its runtime.

qrscan returns a JSON report listing every detected barcode with its text value and symbology. A Code 128 stock label holding STOCK-4827 yields STOCK-4827 as Code 128, while the public EAN-13 sample yields 9506000134352 together with a parsed GS1 payload carrying the 14-digit GTIN 09506000134352. Treat the value as an identifier rather than a product record: preserve every character including leading zeros, and query the system that issued it.

No. A retail barcode number or internal stock code is simply a lookup key for another database. Decoding it does not prove an assigned GS1 identifier, pull a product title or current price, verify authenticity or certify label print quality. Run qrscan --capabilities to see the exact barcode symbologies supported by your build.

No. Reading an existing barcode image uses zero generation credits and activates no trial: it is completely independent of the QR Code AI creation service and its generation API. The creation service has free creation limits, a seven-day Premium trial triggered when you create your first dynamic QR code or Smart Link, and Premium requirements for ongoing use of those features. Decoding an image never changes its encoded data, and the scanner is open source under the MIT licence.