Your laptop camera can read a QR code without an app, a signup, or a server. You open the page, grant the one camera permission, and hold the code up to the lens. In your browser, the video frame is decoded locally and the result appears as text. There is no upload: no frame, no photo, and no snapshot is sent to a decoding service. The only network request is the one that loads the page itself, the same request any website makes. Frame after frame, the decode call runs as a local browser API, so nothing about the code leaves the tab.
That local design has a documented basis. The WICG Shape Detection report says running image analysis on the local device "offers a privacy advantage over offloading computation to a remote system" (WICG Shape Detection, section 3). The same document adds a limit worth keeping in view: decoded results should be treated "as privacy sensitive as the original image from which they were derived." A WiFi password or a contact card pulled from a code is sensitive data. It simply never travels. Browsers also show a camera-in-use indicator and a separate indicator when permission is granted, and the physical camera light is a second tell you can check yourself (MDN getUserMedia).
Key Takeaways
- A laptop or desktop webcam can scan a QR code in the browser, with no app, upload, or signup.
- Camera access needs two gates: an HTTPS secure context and one explicit permission grant.
- Native detection is partial and experimental; a JavaScript decoder is the fallback, not an edge case.
- Scanning returns a string you can inspect, not a page that opens itself.
- The standard in force is ISO/IEC 18004:2024, which replaced the withdrawn 2015 edition.
What a webcam QR scanner actually does
The whole cycle is five short steps, and understanding them clears up most of the confusion about what is happening on your machine.
- Request the camera. The page calls
getUserMedia(), which asks the browser for a video stream. The browser shows a permission prompt; a denial rejects withNotAllowedError, and on a plainhttp://origin thenavigator.mediaDevicesobject is undefined so the call throws aTypeError(MDN getUserMedia). - Receive a local stream. On approval, the browser hands back a
MediaStreamwith a video track. Those frames live in the tab. A camera-in-use indicator appears while the track is live. - Decode a frame. The scanner passes a frame, or a canvas bitmap of it, to a detector. Where the browser exposes
BarcodeDetector.detect(), that call runs on the device; otherwise a JavaScript decoder does the same job in the same tab. The detector rejects withSecurityErrorwhen the image source is cross-origin or the canvas is not origin-clean (WICG image sources), so a foreign pixel source cannot be slipped in. - Read the payload.
detect()resolves to objects whoserawValueis a string, alongside the barcode format and corner coordinates (MDN BarcodeDetector). That string is the output. Nothing has been opened. - Inspect and stop. You read the result, decide what to do with it, and the video track can be stopped when you are finished (MDN MediaStreamTrack.stop).
Scanning a QR code is not the same as visiting the URL
This is the distinction the rest of the page rests on.
A QR code is a symbology that encodes a string. The decoder's entire output is that string in rawValue: a URL, a WiFi configuration, a contact card, or plain text (WICG DetectedBarcode.rawValue). The decode call does not follow the address, open a tab, or run page script. Opening the address is a second, separate act that you initiate after you have read the text.
That gap matters because a URL is only as trustworthy as its source. The WHATWG URL Standard states plainly that "the security of a URL is a function of its environment," and warns that when a URL passes from one party to another, "B should never trust A, as at some point URLs from A can come from untrusted sources" (WHATWG URL Standard, section 2). A code stuck over a legitimate one on a poster is an untrusted source handed to you by a stranger; Wikipedia's risks section describes exactly that sticker-overlay pattern (Wikipedia: QR code, Risks). Decoding first turns an opaque square into readable text you can judge. It never grants the text permission to act.
The bottom line: a scan yields data, and opening what it contains is your decision, made after the decode.
What "processed locally" really means for privacy
Local processing is a real property of this design, not a slogan. getUserMedia() produces a MediaStream on your device, and the Shape Detection detect() call consumes a video frame or canvas bitmap on that same device. No MediaRecorder sits in the decode path, so the stream is not being written to a buffer or a file behind the scenes. When the tab closes, the frames go with it.
The honest limit is the one the spec itself sets. Decoded results are as sensitive as the image they came from (WICG Shape Detection, section 3). A scanned code can contain a home WiFi password or someone's phone number. Saying "the frame and the decoded text stay in this tab" is accurate; saying "no sensitive data is ever created" is not. The result exists locally and stays local, which is the useful property, but it is still data you should handle with care.
Permissions are per origin, and the browser gives you ways to verify the arrangement rather than take the page's word for it. The camera indicator and the physical light show when the device is active. You can query the current permission state with the Permissions API (MDN Permissions.query). If the code on the poster is a screenshot you already saved, the complementary decode path takes a file rather than a camera and works differently.
Native detection is still the exception, not the rule
The browser-native path is not the default everywhere, and treating it as universal is the most common mistake in copy about webcam scanning. MDN labels BarcodeDetector experimental and of limited availability, explicitly "not Baseline because it does not work in some of the most widely-used browsers" (MDN BarcodeDetector).
The compatibility detail matters most. MDN's compatibility data records Chrome desktop support as partial, available on ChromeOS and macOS only, with a note that before Chrome 113 on macOS Ventura the interface could fail silently; Chrome Android has full support; Edge and Opera desktop are partial; Firefox has no support; and Safari 17 ships the interface only behind the "Shape Detection API" preference, mirrored to iOS (MDN browser compatibility). Safari 17 and later ship the interface behind the "Shape Detection API" preference, mirrored to iOS. Desktop Chrome support is platform-dependent, so a Mac visitor should check rather than assume it works.
Google's own guidance says the same thing in different words: the API is "an optimization and not something guaranteed to be available from the platform for every user," and developers are expected to pair it with their own recognition code (Chrome for Developers: Shape Detection). A JavaScript decoder fallback is therefore the normal design, not a concession. getSupportedFormats() lets a page check for qr_code before choosing a path.
The QR standard is ISO/IEC 18004:2024
The earlier edition of this page cited ISO/IEC 18004:2015. That edition was withdrawn on 15 August 2024 and replaced by ISO/IEC 18004:2024, published the same day (ISO/IEC 18004:2015, withdrawn, ISO/IEC 18004:2024). The current edition defines the symbology, including the error-correction rules, reference decoding algorithm, and production quality requirements that decide whether a code is readable at all.
One caution about standards language: MDN's compatibility dataset marks BarcodeDetector as standard-track, but the WICG report states it is not a W3C standard and not on the W3C Standards Track. Use MDN's "experimental, limited availability" wording and do not describe the detector as a W3C standard.
Why a code fails to scan, and how to fix it
Most failed reads are optical, not algorithmic. Before blaming the decoder, work through the physical causes.
- Lighting and glare. A glossy phone screen or a laminated print reflects the camera's own light back at it. Angle the code or soften the light.
- Focus and distance. Hold the code steady and let the camera focus. A code a few centimetres from the lens may be outside its focal range.
- Quiet zone. The blank margin around a QR code is part of the specification. Crop it away, or print on busy artwork, and detection suffers.
- Size and damage. A tiny code gives the decoder few modules to sample. Error correction recovers a surprising amount of damage, but not a missing finder pattern.
- A code on a display. A second monitor or a video-call window refreshes at its own rate, which beats against the camera's frame rate and produces moire. Scaling a code up or down in a window can blur the module edges. A printed copy often scans first try for exactly this reason.
None of these involve the camera being blocked or the payload being rejected. Fix the optics and the same string decodes.
Setting up the camera and switching it off
Two platform gates apply before any scan. First, the page must be a secure context: HTTPS, localhost, and file origins are potentially trustworthy, while plain HTTP is not (W3C Secure Contexts). The spec lists reading input from device sensors, including the camera, among the capabilities that belong in a secure context. Second, the browser asks for one explicit camera permission per origin.
If several cameras are attached, a built-in webcam and a USB camera for example, enumerateDevices() lists them with a deviceId you can pass to getUserMedia() to pick one (MDN enumerateDevices). That is a practical fix for a laptop whose front camera faces the wrong way.
Switching the camera off is a standards-backed operation. MediaStreamTrack.stop() ends the track and releases the source once nothing uses it (W3C Media Capture and Streams). The Media Capture spec also requires the browser to stop all of a document's sources when the page unloads and to keep the physical privacy indicator aligned with the logical track state. For a lasting change, clear the site's camera permission in your browser settings.
Related tools
- QR code decoder for image upload when the code is already a file rather than in front of the camera.
- QR code tools hub for the full set of QR workflows.
- Batch QR generator for printing many codes at once.
- Text to QR code generator to create one, then scan it back here to verify the payload.
