WebUSB lets websites communicate with USB devices directly — no drivers, no native apps, no plugins. Shipped in Chrome 61+ and Edge. Not available in Firefox or Safari for security reasons.
📌 What Is WebUSB?
WebUSB is a W3C WICG API exposing the raw USB protocol to web pages — direct access to USB device endpoints without OS class drivers. Devices must not be claimed by kernel drivers, and can opt in by including a WebUSB descriptor with a landing page URL. Chrome displays a notification popup when such devices connect.
🌐 Browser Support
| Browser | Support | Notes |
|---|---|---|
| Chrome 61+ | ✅ Full support | Desktop + Android Chrome |
| Edge 79+ | ✅ Full support | Chromium-based |
| Firefox | ❌ Not supported | Mozilla: OS driver conflicts + fingerprinting risk |
| Safari | ❌ Not supported | Apple has not shipped WebUSB |
⚙️ The API
// Request access — requires user gesture
const device = await navigator.usb.requestDevice({
filters: [{ vendorId: 0x2341 }] // Arduino
});
await device.open();
await device.selectConfiguration(1);
await device.claimInterface(2);
// Configure the device
await device.controlTransferOut({
requestType: 'class', recipient: 'interface',
request: 0x22, value: 0x01, index: 0x02
});
// Read data
const result = await device.transferIn(5, 64);
console.log(new TextDecoder().decode(result.data));
// Revoke access
await device.forget();🏭 Transfer Types
Control Transfers
controlTransferIn/Out — config commands, gets bus priority.
Bulk Transfers
transferIn/Out — large reliable data (printers, storage).
Interrupt Transfers
transferIn/Out — small time-sensitive data at fixed intervals.
Isochronous Transfers
isochronousTransferIn/Out — audio/video streams, guaranteed bandwidth.
🏢 Real-World Users
| Project | Use Case | Notes |
|---|---|---|
| Arduino Create | Upload sketches from browser | First major commercial user |
| Microsoft MakeCode | Flash micro:bit, Circuit Playground | Millions of students |
| Espruino Web IDE | JavaScript microcontrollers, REPL | espruino.com/ide |
| CircuitPython Web IDE | REPL + file editing on Adafruit boards | code.circuitpython.org |
| Web DFU Tools | Firmware flashing for STM32, ESP32 | No native app needed |
📦 Open Source
Official Arduino WebUSB library — boards declare WebUSB support with a landing page URL.
Official W3C WICG spec — living specification, issues, and explainers for WebUSB API.
Browser-based DFU firmware flasher for STM32 and other DFU-compatible devices in pure JS.
Chrome debug page — simulate virtual WebUSB devices for testing without real hardware.
🔒 Security Model
- User gesture required — requestDevice() only from click/keyboard events
- Browser picker — user must actively select; site cannot auto-choose
- Protected classes blocked — keyboards, mice, audio, mass storage, FIDO blocked
- HTTPS required — secure contexts only (localhost OK for dev)
- Revocable — device.forget() (Ch 101+) or chrome://settings/content/usbDevices
Written by Alex R. | Coding with Alex | Tags: WebUSB, Browser APIs, Hardware, Arduino, IoT, Chrome, Edge