HOWTO · Raspberry Pi

How to Retrieve the MAC Address of Your Raspberry Pi

This article explains how to look up the MAC address of a Raspberry Pi device.

On this page

To find a Raspberry Pi network adapter’s MAC address, run ip link and read the link/ether line under the interface you need. For one adapter, ip link show dev INTERFACE narrows the listing. The examples below use eth0 and wlan0, but names vary by device. ifconfig is another option when it is installed. These commands are intended for Raspberry Pi OS; their device-specific output is not included because it depends on the interfaces present on your Pi.

The ip link command lists network interfaces and link-layer details. On a Raspberry Pi, run it in a terminal. This small example extracts the address from an illustrative link/ether line so you can see which part of the listing to read; the address is sample data, not your Pi’s address.

Run this example:

sample='2: eth0: <BROADCAST,MULTICAST,UP> mtu 1500 link/ether 00:16:3e:e2:52:1c brd ff:ff:ff:ff:ff:ff'
printf '%s\n' "$sample" | sed -n 's/.*link\/ether \([^ ]*\).*/\1/p'
00:16:3e:e2:52:1c

In the listing, find the interface name at the start of a block, then look below it for a line beginning link/ether. The six hexadecimal pairs after that label are the MAC address, sometimes called the hardware address. For example, link/ether 00:16:3e:e2:52:1c contains an illustrative address; your Pi displays its own value. A loopback block instead has link/loopback and is not the address for a wired or wireless adapter.

ip a also lists link-layer addresses, alongside IP addresses and other interface state. Use it if you need that additional network information; ip link is usually easier to scan when your only goal is the MAC address. The details vary with interface state and operating-system configuration, so treat any sample address as an example rather than a value to copy.

After identifying the interface name in the full listing, ask ip to show just that interface with ip link show dev INTERFACE. Replace INTERFACE with a name from your listing, such as eth0 or wlan0.

The focused output still contains a link/ether line. If the command reports that it cannot find the device, list interfaces with ip link and copy an existing name exactly. A name in a guide is only an example; it does not guarantee that your Pi uses that name.

For a broader listing in the same tool, ip a is shorthand for ip address; it can be useful when you also need to compare the adapter’s IP address or whether it is up. It does not change which value is the MAC address: look for link/ether, not the inet line, which contains an IPv4 address.

Use ifconfig as an alternative

If you already use ifconfig, it can display interface details too. Availability varies between installations, so first check whether the utility exists. Run ifconfig INTERFACE, replacing INTERFACE with a name from your listing, such as eth0 or wlan0.

In ifconfig output, find the block for your chosen interface and look for a field labeled ether or HWaddr, depending on the version. The hexadecimal value beside that label is the MAC address. Replace eth0 with the interface you identified; use ifconfig without an interface argument if you want to inspect the available blocks. Do not assume the utility is installed just because another Raspberry Pi has it.

Choose the correct interface and interpret the output

eth0 is a common name for wired Ethernet, and wlan0 is a common name for Wi-Fi, but Raspberry Pi OS versions, configuration, adapters, and naming rules can produce different names. A Pi can also show virtual or additional interfaces. Use the names in your own ip link listing rather than assuming there are exactly two network interfaces.

Choose the adapter whose address you need: select the wired interface for a wired connection or the wireless interface for Wi-Fi. Ignore lo for this purpose; it is the loopback interface used by the local system. On the selected block, read the value following link/ether in ip output, or ether/HWaddr in ifconfig output. MAC addresses are commonly displayed as six pairs of hexadecimal digits separated by colons. The address belongs to that interface, so a device with multiple adapters can have more than one MAC address.

If a targeted command does not show the expected interface, return to the full listing and choose a name that appears there. If ifconfig is unavailable, use ip link, which provides the same relevant link-layer address without requiring the alternative utility.