Barcode Scanner Tool
Scan, decode, identify, and analyze barcodes instantly using live camera scanning, image uploads, and smart barcode recognition.
Live scanner
Point the camera at a barcode or QR code. The detection overlay activates when a code aligns inside the frame.
Ready to scan
Tap Start camera. Your browser will ask once for camera permission — choose Allow to begin scanning.
Upload barcode image
Drag-and-drop multiple JPG, PNG, or WEBP files. Decoded entirely on your device — nothing is uploaded.
Drag images here or click to browse
Supports JPG · PNG · WEBP · multi-file batch decode
Scan history
Stored locally in your browser — 0 scans saved.
No scans yet
Start the camera or upload an image to add scans to your history.
The most modern way to scan a barcode in a browser
A barcode is one of the most boring objects in the world that turns out to be doing the world's most interesting job — turning a fistful of black bars or a square of pixels into a number the global supply chain agrees on. The SamCalculator Barcode Scanner Tool decodes any of the 13 major retail, industrial, library, and event-ticket barcode formats from your laptop or phone camera, an uploaded image, or a drag-and-drop screenshot. Everything happens locally in your browser, no pixel ever leaves your device, and the decoded value drops into a result card with country-of-origin, ISBN intelligence, security flags for QR-encoded URLs, and a scan history you fully own.
How a barcode scanner actually works
1D barcodes — width is the alphabet
A 1D barcode (UPC-A, EAN-13, Code 128, ITF) encodes information in the relative width of its black bars and white spaces. The scanner samples a horizontal line across the code, measures the run-length of each bar and gap, normalises against the narrowest module, and looks up the resulting pattern in the format's symbology table. UPC-A and EAN-13 use a fixed-width 7-module encoding for every digit; Code 128 packs three digits into 11 modules using a stateful character set; ITF interleaves two digits inside a single bar pattern to halve the printed width.
2D codes — Reed–Solomon recovery
A 2D code (QR Code, Data Matrix, Aztec, PDF417) is a matrix of dark and light pixels. The decoder first finds the three position-detection patterns (the big square brackets in a QR), uses them to recover the rotation and perspective, then samples the data modules. Reed–Solomon error correction is mixed into the data, so up to 30% of a QR can be destroyed and the decode still succeeds — which is why a QR sticker with a coffee stain still scans, but a Code 128 with a single torn bar usually doesn't.
The browser-native engine
SamCalculator uses the browser's native BarcodeDetector API where available — Chrome and Edge on Android, macOS, Windows, ChromeOS, and Safari on iOS 17+. This is the same engine the Files app, Google Lens, and the Camera app use, accelerated by the system's vision pipeline. The page never ships a multi-megabyte WebAssembly decoder; everything runs through the OS.
Checksums — the safety net
Every format has a final check digit computed from the leading data: UPC and EAN use a mod-10 weighted sum (3×, 1×, 3×, 1×…); Code 39 uses mod-43; Code 128 uses a position-weighted mod-103; QR uses Reed–Solomon polynomial recovery. The Barcode Scanner Tool only surfaces a decoded value if the checksum validates — a partial or noisy decode that produces an invalid checksum is silently dropped, so you never get a wrong number returned as if it were right.
9 ways to use the Barcode Scanner Tool
Retail product lookup
Scan the EAN-13 on a grocery item — the country-of-origin prefix tells you instantly whether it was manufactured in Germany (400–440), China (690–699), or India (890). Pair the decoded GTIN with an Open Food Facts API call for nutritional data.
Library and bookshop ISBN
Switch to Library mode and scan the barcode on the back of any book — the 978/979 Bookland prefix is auto-detected and the ISBN-13 is highlighted. Connect Open Library or Google Books for live title, cover, and author metadata.
Warehouse stock-count audits
Inventory mode keeps multi-barcode detection active. Sweep the camera over a shelf, every Code 128 or Data Matrix in view drops into your scan history with a duplicate warning if a SKU is double-counted.
Event ticket validation
Concert tickets, boarding passes, and transit passes use Aztec (transit), PDF417 (boarding), or QR (general events). Ticket mode prioritises those three formats so even crumpled paper tickets resolve quickly.
Shipping label reading
Drag a screenshot of a FedEx, UPS, or USPS label into the upload zone. Multi-barcode detection picks up the Code 128 tracking number, the GS1-128 routing code, and the postal IMb in one pass.
QR business cards
Scan a vCard or MeCard QR — the tool unpacks the contact into a copy-friendly text block ready to paste into your contacts app. URL QRs are run through a security check (link shortener, raw IP, http://) before you click.
Wi-Fi join via QR
The Wi-Fi QR format (WIFI:T:WPA;S:Name;P:Password;;) is auto-recognised and the SSID, encryption, and password are extracted into separate fields you can copy individually.
Healthcare and pharmacy IDs
Pharmaceutical packaging uses GS1 Data Matrix to encode the serial number, batch, expiry, and GTIN in one square. Warehouse mode prioritises Data Matrix and surfaces the parsed AI fields.
Batch image decoding
Drop a folder of photographed barcodes into the upload zone — each image is decoded sequentially and added to your history with the source filename. Export the full batch as CSV for spreadsheet analysis.
Best practices for a clean scan
Light, flat, and 6–10 inches away
The biggest cause of failed decodes is glare from glossy packaging. Tilt the package five degrees off-axis from your overhead light, or move to ambient light. Hold the camera 6–10 inches from the code so the barcode fills 60–80% of the scan frame.
Use the back camera
The front-facing camera on a phone is typically lower resolution and softer; switch to the back camera (the default on the tool) and the autofocus system on the rear lens locks far more reliably onto a sharp barcode.
Turn on the flashlight in low light
Below 200 lux (typical living room at night), even modern phone cameras start to over-amplify ISO noise, which destroys the high-frequency detail in narrow 1D bars. The flashlight toggle uses the device's LED torch and rescues most low-light failures.
Crop and zoom for tiny codes
A 25 mm square Data Matrix on a pharmaceutical box requires the camera to resolve sub-millimetre modules. Pinch-to-zoom in the camera (or zoom into an uploaded image) so the smallest module is at least 3–4 pixels wide.
Flatten curved surfaces
Barcodes on cans, bottles, and pill packets curve under the camera. The decoder can tolerate up to ~15° of curvature in 2D codes and almost zero in 1D. Rotate the package so the bars run parallel to the curve's axis (vertically across a can), not around it.
Rotate, don't tilt
Modern decoders are rotation-invariant — they don't care if the barcode is upside down. They care a lot more about perspective tilt. Hold the camera parallel to the surface; if you can't, photograph the barcode then crop in the upload zone.
Why barcodes still matter in 2026
More than 10 billion barcodes are scanned every day across global retail. The format is older than the internet — the first commercial scan was a 10-pack of Wrigley's Juicy Fruit in 1974 — yet it is what holds the supply chain together. Every change to a delivery, every inventory move, every checkout aisle, every prescription dispense, every blood-bag transfusion, every package tracked overnight: every one of those events is keyed to a barcode that someone scanned. Replacing barcodes with RFID has been promised for 25 years; it hasn't happened, because barcodes cost a fraction of a cent to print and need no power source.
For individuals and small businesses, a browser-based scanner is the cheapest way to plug into that infrastructure. You don't need a Zebra TC73, you don't need a $400/year POS subscription, you don't need a backend. You need a phone camera, a modern browser, and 30 seconds — and you can build inventory exports, library catalogs, ticketing systems, and pricing workflows on top of the same scans that big retailers depend on.
Tricky cases the tool handles
- ISBN-10 vs ISBN-13. Older books carry a 10-digit ISBN. Every ISBN-10 maps to a 13-digit ISBN by prepending 978 and recomputing the check digit. The decoder detects the prefix automatically and surfaces both representations.
- Truncated UPC-E. The compressed UPC-E format zero-suppresses an 11-digit UPC-A down to 6 visible digits plus a check. The tool expands UPC-E back to the full 12-digit GTIN so country lookup works correctly.
- GS1-128 with Application Identifiers. Carrier labels embed AIs like (01) GTIN, (10) batch, (17) expiry. The decoder returns the raw payload — the AIs can be parsed downstream.
- Damaged QR with logos. A QR with a centered brand logo destroys up to 15% of the data area; Reed–Solomon recovers it. The Barcode Scanner Tool accepts logo-style QRs without manual intervention.
- Screen-rendered QR. A QR shown on another phone or monitor often has moiré patterns and refresh-rate artifacts. Switch to upload mode and screenshot the screen — the static screenshot decodes more reliably than the live camera feed.
Core formulas
UPC / EAN check digit (mod-10)
check = (10 − ((3·d1 + d2 + 3·d3 + d4 + … + 3·d11 + d12) mod 10)) mod 10The check digit is the value that, added to the weighted sum of the leading digits, makes the total a multiple of ten. Reverse the weighting (3-then-1) for UPC-A (12 digits) and EAN-13 (13 digits).
Code 128 check character (mod-103)
check = (Σ (position_i · value_i) + start_value) mod 103Every Code 128 symbol carries a position-weighted check that reuses the symbol's own value table. Without the check, you cannot tell which Code 128 character set (A, B, or C) is active.
QR error correction
ec_codewords = generator_polynomial · message_polynomial (mod GF(256))QR's four error-correction levels — L (7%), M (15%), Q (25%), H (30%) — encode redundant Reed–Solomon codewords over the Galois field GF(256). Higher levels add more redundancy at the cost of capacity.
Common mistakes to avoid
- Trusting a QR code from a flyer. A QR sticker can be physically replaced with a malicious one — always check the decoded URL preview before tapping. The tool flags link shorteners, bare IP addresses, and unencrypted http:// links.
- Assuming UPC = country of manufacture. The GS1 prefix encodes the country of the registered company that issued the GTIN, not where the product was made. A US-headquartered brand manufacturing in Vietnam will still carry a 0xx US prefix.
- Photographing a curved barcode head-on. Cans and bottles bend the bars into perspective curves. Move to a 90° side angle so the bars run vertically across the curvature, then scan.
- Re-scanning the same code by accident. Inventory counts often double-record an item. Leave the "Highlight duplicates" toggle on — the history panel marks any repeat with an amber DUP badge.
How we built this
The Barcode Scanner Tool is built on the browser-native BarcodeDetector API documented by the WICG and supported in Chrome, Edge, Opera, Safari iOS 17+, and Android Chrome. Format coverage and check-digit logic follow the GS1 General Specifications (release 24.1, January 2024) for UPC-A, UPC-E, EAN-13, EAN-8, ITF, and GS1-128. ISBN behavior follows ISO 2108:2017 (Bookland prefix and 13-digit reformulation). QR code decoding adheres to ISO/IEC 18004:2015. Camera access uses the W3C Media Capture and Streams specification (getUserMedia + MediaTrackConstraints.torch). The tool itself ships zero remote requests at runtime — no analytics, no decode service, no API calls. Your camera feed, your uploaded images, your scan history, and your decoded values stay on your device.
Frequently asked questions
Related tools
More privacy-first utilities from SamCalculator — passwords, randomness, conversions, and writing tools that all run locally in your browser.
- Password GeneratorGenerate strong, secure passwords with custom length and complexity.
- Password Strength CheckerCheck password strength, entropy, crack time, and breach risk.
- Random Number GeneratorRandom integers, decimals, lottery picks, dice rolls, coin flips, PINs, and bingo.
- Word CounterCount words, check readability, and analyze your writing in real-time.
- Unit ConverterAll-in-one converter for 40+ measurement categories with natural-language input.
- Dice RollerRoll D4–D100, parse 2d6+3 notation, with advantage, exploding dice, and RPG mode.