getmac - Check MAC Addresses

Maintained on
Table of Contents

The getmac command lists the MAC addresses (physical addresses) of your PC’s network adapters.

A MAC address is an identification number assigned to each piece of network hardware. You need it for things like MAC address filtering on a router or managing network devices.

Basic Usage

Syntax
getmac [/v] [/fo format] [/nh] [/s computer [/u user [/p password]]]

Run without arguments, it shows MAC addresses and transport names.

- □ ×
Command Prompt Icon
Command Prompt
Microsoft Windows [Version xx.x.xxxxx.xxx]
(c) 2026 Ribbit App Development All rights reserved.
 
C:\users\user>getmac
Physical Address Transport Name
=================== ==========================================================
00-1A-2B-3C-4D-5E \Device\Tcpip_{12345678-ABCD-1234-ABCD-1234567890AB}
00-1A-2B-3C-4D-5F Media disconnected
C:\users\user>

MAC addresses appear as pairs of hexadecimal digits joined by hyphens, like 00-1A-2B-3C-4D-5E.

Output varies by environment

The output above is only an example. MAC addresses and transport names differ on every PC. On a Japanese version of Windows, the headings and messages appear in Japanese.

Show Adapter Names Too (/v)

In the default output, it is hard to tell which address belongs to which adapter. Add /v to also show the connection name and adapter name.

getmac /v
- □ ×
Command Prompt Icon
Command Prompt
Microsoft Windows [Version xx.x.xxxxx.xxx]
(c) 2026 Ribbit App Development All rights reserved.
 
C:\users\user>getmac /v
Connection Name Network Adapter Physical Address Transport Name
=============== ================================== ================= ====================
Ethernet Realtek PCIe GbE Family Controller 00-1A-2B-3C-4D-5E \Device\Tcpip_{…}
Wi-Fi Intel(R) Wi-Fi 6 AX201 160MHz 00-1A-2B-3C-4D-5F Media disconnected
C:\users\user>

The connection name corresponds to names such as “Ethernet adapter” and “Wireless LAN adapter” in ipconfig.

When the transport name says "Media disconnected"

An adapter whose cable is unplugged, or that is not connected to Wi-Fi, shows “Media disconnected” instead of a transport name. To find the MAC address of the connection you are using now, look for the row whose transport name is \Device\Tcpip_....

Change the Output Format (/fo)

/fo sets the output format: TABLE (default), LIST, or CSV.

FormatDescription
TABLEShow as a table (default)
LISTShow one item per line
CSVShow as comma-separated values
getmac /fo csv
- □ ×
Command Prompt Icon
Command Prompt
Microsoft Windows [Version xx.x.xxxxx.xxx]
(c) 2026 Ribbit App Development All rights reserved.
 
C:\users\user>getmac /fo csv
”Physical Address”,“Transport Name"
"00-1A-2B-3C-4D-5E”,“\Device\Tcpip_{12345678-ABCD-1234-ABCD-1234567890AB}”
C:\users\user>

CSV is handy when you save the output to a file with > and open it in Excel.

getmac /v /fo csv > mac.csv

Omit the Header (/nh)

/nh removes the header row. It works with the TABLE and CSV formats.

getmac /fo csv /nh
- □ ×
Command Prompt Icon
Command Prompt
Microsoft Windows [Version xx.x.xxxxx.xxx]
(c) 2026 Ribbit App Development All rights reserved.
 
C:\users\user>getmac /fo csv /nh
”00-1A-2B-3C-4D-5E”,“\Device\Tcpip_{12345678-ABCD-1234-ABCD-1234567890AB}”
C:\users\user>

Check Another PC’s MAC Address (/s)

Specify a computer name or IP address with /s to get the MAC addresses of another PC on the network.

getmac /s PC-01 /u DOMAIN\username

You can pass the password with /p, but it can remain on screen or in your history, so it is better to omit it and type it when prompted.

Remote queries need permissions and settings

You need administrator rights on the remote PC, and remote management must be allowed by its firewall and other settings. Use this only on PCs you are authorized to manage.

Extract the MAC Address in a Batch File

This example stores only the first adapter’s MAC address in a variable.

get-mac.cmd
@echo off
for /f "tokens=1 delims=," %%a in ('getmac /fo csv /nh') do (
    set MAC=%%~a
    goto :done
)
:done
echo MAC address: %MAC%

Using /fo csv /nh gives headerless CSV, which is easy to handle with for /f. The ~ in %%~a removes the surrounding double quotes.

The first row is not always the adapter in use

This example takes the first row of the list. Virtual or disconnected adapters can come first, so use getmac /v to check adapter names when you need to be sure.

Summary

GoalCommand
Check MAC addressesgetmac
Show adapter names toogetmac /v
Output as CSVgetmac /fo csv
Omit the headergetmac /fo csv /nh
Check another PCgetmac /s computer

Practice Questions

Practice Problem

Which option shows each MAC address together with its adapter name?

Choose one answer.

  1. /nh
  2. /v
  3. /s

Practice Problem

How do you save the getmac output as a file that Excel can open?

Choose one answer.

  1. getmac /fo list > mac.csv
  2. getmac /fo csv > mac.csv
  3. getmac /nh | mac.csv
#Command Prompt #Batch Files #Network #Commands #getmac #MAC Address