Limited supportUse with care and provide a fallback when broad support matters.

Overview

The navigator.serial API communicates with devices over serial ports, such as microcontrollers. It is most useful when native HTML semantics or browser capabilities can replace custom implementation work.

Browser support

Feature Desktop Mobile
Chrome
Edge
Firefox
Safari
Chrome Android
Safari iOS
Serial
Experimental
89
89
138
serial
Experimental

The serial read-only property of the Navigator interface returns a Serial object which represents the entry point into the Web Serial API.

89
89
138
getPorts
Experimental

The getPorts() method of the Serial interface returns a Promise that resolves with an array of SerialPort objects representing serial ports connected to the host which the origin has permission to access.

89
89
138
requestPort
Experimental

The Serial.requestPort() method of the Serial interface presents the user with a dialog asking them to select a serial device to connect to. It returns a Promise that resolves with an instance of SerialPort representing the device chosen by the user.

89
89
138
requestPort (allowedBluetoothServiceClassIds option)
Experimental

`allowedBluetoothServiceClassIds` option

117
117
138
requestPort (filters bluetoothServiceClassId)
Experimental

`filters` `bluetoothServiceClassId` property

117
117
138
SerialPort
Experimental

The SerialPort interface of the Web Serial API provides access to a serial port on the host device.

89
89
138
close
Experimental

The SerialPort.close() method of the SerialPort interface returns a Promise that resolves when the port closes.

89
89
138
connect_event
Experimental

The connect event of the SerialPort interface is fired when the port connects to the device.

89
89
138
connect_event (bluetooth rfcomm)
Experimental

Bluetooth RFCOMM serial ports dispatch `connect` events

130
130
138
connected
Experimental

The connected read-only property of the SerialPort interface returns a boolean value that indicates whether the port is logically connected to the device.

130
130
138
disconnect_event
Experimental

The disconnect event of the SerialPort interface is fired when the port disconnects from the device.

89
89
138
disconnect_event (bluetooth rfcomm)
Experimental

Bluetooth RFCOMM serial ports dispatch `disconnect` events

130
130
138
forget
Experimental

The SerialPort.forget() method of the SerialPort interface returns a Promise that resolves when access to the serial port is revoked.

103
103
138
getInfo
Experimental

The getInfo() method of the SerialPort interface returns an object containing identifying information for the device available via the port.

89
89
138
getInfo (bluetoothServiceClassId)
Experimental

`bluetoothServiceClassId` return value property

117
117
138
getSignals
Experimental

The SerialPort.getSignals() method of the SerialPort interface returns a Promise that resolves with an object containing the current state of the port's control signals.

89
89
138
open
Experimental

The open() method of the SerialPort interface returns a Promise that resolves when the port is opened. By default the port is opened with 8 data bits, 1 stop bit and no parity checking. The baudRate parameter is required.

89
89
138
readable
Experimental

The readable read-only property of the SerialPort interface returns a ReadableStream for receiving data from the device connected to the port. Chunks read from this stream are instances of Uint8Array. This property is non-null as long as the port is open and has not encountered a fatal error.

89
89
138
setSignals
Experimental

The setSignals() method of the SerialPort interface sets control signals on the port and returns a Promise that resolves when they are set.

89
89
138
writable
Experimental

The writable read-only property of the SerialPort interface returns a WritableStream for sending data to the device connected to the port. Chunks written to this stream must be instances of ArrayBuffer, TypedArray, or DataView. This property is non-null as long as the port is open and has not encountered a fatal error.

89
89
138
serial
Experimental

The serial read-only property of the WorkerNavigator interface returns a Serial object which represents the entry point into the Web Serial API.

89
89
138
Other
html.elements.iframe.allow.serial
Experimental
89
89
89

The HTTP Permissions-Policy header serial directive controls whether the current document is allowed to use the Web Serial API to communicate with serial devices, either directly connected via a serial port, or via USB or Bluetooth devices emulating a serial port.

89
89
89
1+Supported (version) Not supported Has note Sub-feature descriptions sourced from MDN Web Docs (CC BY-SA 2.5)
Notes 2 item(s)
Limitation
  • This browser only partially implements this feature
Implementation note
  • Serial ports are only available if they're provided by Bluetooth RFCOMM serial port emulation.
Notes 2 item(s)
Limitation
  • This browser only partially implements this feature
Implementation note
  • Serial ports are only available if they're provided by Bluetooth RFCOMM serial port emulation.
Notes 2 item(s)
Limitation
  • This browser only partially implements this feature
Implementation note
  • Serial ports are only available if they're provided by Bluetooth RFCOMM serial port emulation.
Notes 2 item(s)
Limitation
  • This browser only partially implements this feature
Implementation note
  • Serial ports are only available if they're provided by Bluetooth RFCOMM serial port emulation.

Syntax

JAVASCRIPT
const port = await navigator.serial.requestPort();
await port.open({ baudRate: 9600 });
const reader = port.readable.getReader();
const { value } = await reader.read();
console.log('Received:', new TextDecoder().decode(value));

Use cases

  • Use Web serial

    Use Web serial when standard HTML needs a more specific platform feature, semantic signal, or browser capability.

  • Handle edge cases

    Apply Web serial to solve a focused requirement without redesigning the whole page architecture.

Cautions

  • Test Web serial in your target browsers and input environments before depending on it as a primary behavior.
  • Provide a fallback path or acceptable degradation strategy when support is still limited.

Accessibility

  • Make sure Web serial supports the intended task without making the page harder to perceive, understand, or operate.

Powered by web-features