Every device on a network has both. The MAC address is burned into the network hardware and stays with it. The IP address is handed out when the device connects and taken back when it leaves. They are easy to mix up because both are "the device's address", but they do different things and almost never appear in the same place.
The short version
| MAC address | IP address | |
|---|---|---|
| Assigned by | The manufacturer, at the factory | Your router (DHCP) or a network admin, when you connect |
| Changes? | No, unless the device randomizes it | Yes. Every network, and often every few days on the same one |
| Looks like | A1:B2:C3:D4:E5:F6 | 192.168.1.42 or 2001:db8::1 |
| Travels | Only across the local network | Across the whole internet |
| Layer | Link layer (layer 2) | Network layer (layer 3) |
| A lookup gives you | The maker of the network chip | The Internet provider and a rough location |
What each one is for
The MAC address gets data to the right device on the local network. Your Wi-Fi router or switch keeps a table of which MAC address is on which port or radio, and uses it to deliver each frame. It never needs to know anything beyond the devices it can reach directly.
The IP address gets data to the right network anywhere in the world. Routers along the way look at the destination IP address and pass the packet one hop closer. Your home network has a public IP address that the rest of the internet sees, and each device inside has a private one that only your router cares about.
A useful way to hold it: the MAC address is the name on the device, and the IP address is its seat number for this session.
How they work together
- DHCP is how your router hands out IP addresses, and it keys them on the MAC address. That is why a "DHCP reservation" lets you give one device the same IP address every time.
-
ARP
(and its IPv6 equivalent, neighbour discovery) is how a device finds the MAC address that goes with an IP address on the local network. Run
arp -aon a computer and you will see the table it has built. - Every router rewrites the MAC address. When a packet leaves your network, the router puts its own MAC address on it, and the next router does the same. The IP addresses stay, the MAC addresses do not. A web server never sees your device's MAC address.
Can you get one from the other?
-
IP address to MAC address:
only on the same local network. Your router's device list shows both side by side, and
arp -aon a computer shows the ones it has talked to recently. For an IP address out on the internet, there is no way, because the MAC address was stripped off at the first router. - MAC address to IP address: the same. Fine on your own network, impossible anywhere else.
- MAC address to a location: no. Our guide on who owns a MAC address goes into what a lookup can and cannot tell you.
- IP address to a location: roughly. Public IP addresses are allocated to Internet providers by region, so a lookup gives the provider and usually the city, but not a street.