Media & Capture

Barcode Detection

Probing…

Barcode Detection is a web platform capability in the Media & Capture category. Detect QR codes and barcodes in images or camera frames. Supported in Chromium 83+; not available in Firefox and Safari. Requires a secure context (HTTPS or localhost).

Secure context

Try it

Loading demo…

Code

const detector = new BarcodeDetector()

// From an uploaded image
const bitmap = await createImageBitmap(file)
const codes = await detector.detect(bitmap)
console.log(codes[0]?.format, codes[0]?.rawValue)

// Or per video frame for live scanning
const live = await detector.detect(videoEl)

Browser support

Chromium
83
Firefox
No
Safari
No

Frequently asked questions

Which browsers support Barcode Detection?

Supported in Chromium 83+; not available in Firefox and Safari.

Does Barcode Detection require HTTPS?

Yes. Barcode Detection needs a secure context, so it only works over HTTPS (or on localhost during development).

What is Barcode Detection used for?

Detect QR codes and barcodes in images or camera frames.

Can I try Barcode Detection in my browser?

Yes. shwcs.net runs a live Barcode Detection demo that probes your current browser and lets you try the API. Everything runs locally — nothing is sent anywhere.

MDN reference ↗ Specification ↗