Get to know MDN better
This feature is not Baseline because it does not work in some of the most widely-used browsers.
Experimental: This is an experimental technology
Check the Browser compatibility table carefully before using this in production.
Secure context: This feature is available only in secure contexts (HTTPS), in some or all supporting browsers.
Note: This feature is available in Web Workers.
The WebUSB API provides a way to expose non-standard Universal Serial Bus (USB) compatible devices services to the web, to make USB safer and easier to use.
USB is the de-facto standard for wired peripherals. The USB devices that you connect to your computer are typically grouped into a number of device classes—such as keyboards, mice, video devices, and so on. These are supported using the operating system's class driver. Many of these are also web accessible via the WebHID API.
In addition to these standardized devices, there are a large number of devices that don't fit into any class. These need custom drivers, and are inaccessible from the web due to the native code required to take advantage of them. Installing one of these devices often involves searching on a manufacturer's website for drivers and, should you wish to use the device on another computer, repeating the process again.
WebUSB provides a way for these non-standardized USB device services to be exposed to the web. This means that hardware manufacturers will be able to provide a way for their device to be accessed from the web, without having to provide their own API.
When connecting a new WebUSB-compatible device, the browser displays a notification providing a link to the manufacturer's website. On arriving at the site the browser prompts for permission to connect to the device, then the device is ready for use. No drivers need be downloaded and installed.
Provides attributes and methods for finding and connecting USB devices from a web page.
USBConnectionEventThe event type passed to USB connect or disconnect events when the user agent detects a new USB device has been connected to, or disconnected from the host.
USBDeviceProvides access to metadata about a paired USB device and methods for controlling it.
USBInTransferResultRepresents the result from requesting a transfer of data from the USB device to the USB host.
USBOutTransferResultRepresents the result from requesting a transfer of data from the USB host to the USB device.
USBIsochronousInTransferPacketRepresents the status of an individual packet from a request to transfer data from the USB device to the USB host over an isochronous endpoint.
USBIsochronousInTransferResultRepresents the result from requesting a transfer of data from the USB device to the USB host.
USBIsochronousOutTransferPacketRepresents the status of an individual packet from a request to transfer data from the USB host to the USB device over an isochronous endpoint.
USBIsochronousOutTransferResultRepresents the result from requesting a transfer of data from the USB host to the USB device.
USBConfigurationProvides information about a particular configuration of a USB device and the interfaces that it supports.
USBInterfaceProvides information about an interface provided by the USB device.
USBAlternateInterfaceProvides information about a particular configuration of an interface provided by the USB device.
USBEndPointProvides information about an endpoint provided by the USB device.
The following example demonstrates how to access a connected Arduino device using USB.requestDevice(), which has a vendorId of 0x2341.
You can find all connected devices with USB.getDevices(). In the following example, with the Arduino device connected, product and manufacturer name are printed to the console.
| WebUSB API |
Enable JavaScript to view this browser compatibility table.
This page was last modified on Jul 12, 2025 by MDN contributors.
Your blueprint for a better internet.
Visit Mozilla Corporation’s not-for-profit parent, the Mozilla Foundation.
Portions of this content are ©1998–2026 by individual mozilla.org contributors. Content available under a Creative Commons license.