Hardware

COM Ports on This Computer: How to Find Them in Windows

To see the COM ports on this computer, open Device Manager (right-click Start, then Device Manager) and expand Ports (COM & LPT). Each entry shows its name with the port number in brackets, such as (COM3).

If that category is missing, or you need the list in a script, three commands below print the same information. Everything here applies to Windows 10 and Windows 11.

Find COM ports in Device Manager

  1. Right-click the Start button and select Device Manager. You can also press Win + R, type devmgmt.msc and press Enter.
  2. Find the category Ports (COM & LPT) and click the arrow beside it to expand it.
  3. Read the number in brackets at the end of each entry name.

Example entries (yours will differ):

Ports (COM & LPT)
    Communications Port (COM1)
    USB Serial Device (COM4)

"Communications Port" is usually a built-in serial port. A name such as "USB Serial Device" means a USB adapter, or a board that presents itself to Windows as a serial device, and it gets its number when you plug it in. The text before the number depends on the driver, so a vendor adapter may show the chip or brand name instead.

LPT in the category name stands for parallel ports, which are rare on current PCs. You will normally see only COM entries.

Which entry is my device?

When several adapters are connected, the quickest test is to unplug the one you care about and watch Device Manager. The list refreshes within a moment, and the entry that disappears was your device. Plug it back in and note the number that returns. The number can change after you move the device to another USB port, so check again after moving a cable.

If an entry has a yellow warning icon, the device is present but Windows could not start it. Right-click it, choose Properties, and read the message on the General tab. Driver problems for USB-connected hardware are covered in Universal Serial Bus controllers in Device Manager.

List COM ports with the mode command

Open Command Prompt or PowerShell and run:

mode

Microsoft's documentation says that mode without parameters displays all the controllable attributes of the console and the available COM devices. The output is a series of blocks, one per device, headed by lines such as Status for device COM1:. Example output, trimmed:

Status for device COM4:
-----------------------
    Baud:            9600
    Parity:          None
    Data Bits:       8
    Stop Bits:       1
    Timeout:         OFF
    XON/XOFF:        OFF
    CTS handshaking: OFF
    DSR handshaking: OFF
    DSR sensitivity: OFF
    DTR circuit:     ON
    RTS circuit:     ON

To check a single port, name it:

mode com4

The same command can also change the settings. For example, mode com4 baud=9600 parity=n data=8 stop=1 sets 9600 baud, no parity, 8 data bits and 1 stop bit. The syntax in Microsoft's reference is mode com<m>[:] [baud=<b>] [parity=<p>] [data=<d>] [stop=<s>], plus handshake options. Many terminal programs set their own values when they open the port, so you often do not need this step.

List COM ports in PowerShell

The Win32_SerialPort class represents serial ports on Windows. Query it with:

Get-CimInstance -ClassName Win32_SerialPort | Select-Object DeviceID, Name

Example output:

DeviceID Name
-------- ----
COM1     Communications Port (COM1)
COM4     USB Serial Device (COM4)

Microsoft's class reference describes DeviceID as the unique identifier of the serial port, and it maps to the registry location Hardware\DeviceMap\SerialComm. Other useful properties on the same object are Description, PNPDeviceID and MaxBaudRate.

If that command prints nothing but Device Manager does show a port, query every Plug and Play device whose name contains a COM number instead:

Get-CimInstance -ClassName Win32_PnPEntity -Filter "Name LIKE '%(COM%'" | Select-Object Name, Status

The Status column shows OK for a working device. This query matches on the name text, so it also picks up any device that happens to have "(COM" in its name.

For a plain list of port names, call the .NET method that many programs use:

[System.IO.Ports.SerialPort]::GetPortNames()

Microsoft documents GetPortNames as returning an array of serial port names for the current computer, and says the order of the names is not specified. Sort the output if you need a stable order.

List COM ports from the registry

Windows keeps the active serial ports under one registry key. Reading it is safe because the command only displays values:

reg query HKLM\HARDWARE\DEVICEMAP\SERIALCOMM

Example output:

HKEY_LOCAL_MACHINE\HARDWARE\DEVICEMAP\SERIALCOMM
    \Device\Serial0    REG_SZ    COM1
    \Device\USBSER000    REG_SZ    COM4

The right-hand column is the port name. The left-hand column is the internal device name, and its form depends on the driver. Microsoft's GetPortNames documentation names this exact key, HKEY_LOCAL_MACHINE\HARDWARE\DEVICEMAP\SERIALCOMM, as the source of port names, and warns that stale or incorrect registry data makes the method return incorrect data. So if a program offers a COM port that Device Manager does not list, the registry list is the first place to look.

Which method should you use?

MethodShowsBest for
Device ManagerName, number, driver statusFinding which device owns which port
modeBaud, parity, data and stop bitsChecking the current settings of a port
Win32_SerialPortName, ID, capabilitiesScripts and inventory
reg queryPort names onlyComparing against what a program reports

If a COM port is missing

  • No Ports category at all. No port device is installed. Plug in the adapter and look again. Check Other devices for a warning icon.
  • Device listed but no number. The driver did not finish installing. Install the driver from the adapter or board maker, then replug it.
  • Program cannot see the port. Close any other program that has the port open, since a serial port can usually be opened by one program at a time. Then check the number against the lists above, because some older programs accept only COM1 to COM9.
  • Port number changed. The device was plugged into a different USB port, or a second adapter took the number. Look it up again with Device Manager or mode and update the setting in your program.

Settings such as baud rate must match on both ends. If the device's manual says 115200 baud and your program uses 9600, the port will open but the text will be garbage.

Frequently asked questions

Why does Device Manager show no Ports (COM & LPT) category?
The category only appears when Windows has at least one port device installed. A PC with no built-in serial port and no USB serial adapter plugged in will not show it. Plug in the adapter or device, wait a few seconds, and the category should appear. If the device is plugged in but there is still no category, look under Other devices for an entry with a yellow warning icon, which usually means the driver is missing.
Why does a COM port number show up in a program but not in Device Manager?
Programs that use SerialPort.GetPortNames read port names from the registry key HKEY_LOCAL_MACHINE\HARDWARE\DEVICEMAP\SERIALCOMM. Microsoft's documentation warns that if the registry contains stale or otherwise incorrect data, the method returns incorrect data. Unplug the device, replug it, and compare the registry list with Device Manager again.
What is the highest COM port number I can use?
Microsoft's mode command documentation lists COM1 through COM9 as the standard names, unless the system has special hardware for additional COM ports. Ports above COM9 exist on Windows, but some older programs only accept COM1 to COM9, so a tool that cannot see COM12 is a program limit, not a missing port.
Is a COM port the same as a USB port?
No. A COM port is a serial port, a software name such as COM3 that programs use to talk to a serial device. A USB serial adapter or a board that presents itself as a virtual serial device gets a COM number when you plug it in, but a normal USB storage device or mouse does not.

Sources