MAC address one of the two critical elements of networking. You’ll learn all about it in this post. The first thing to keep in mind is a MAC address is different from an IP address, though the two co-exist nicely. You can even say they depend on each other.
That said, it’s a good idea that you check out my explainer on the IP address before (or after) this post.
Dong’s note: I first published this post on March 1, 2019, and updated it on January 25, 2021, to include additional relevant information.
What is a MAC address
MAC stands for media access control. So a MAC address — I’ll call it MAC from now on for short — is precisely that, the unique identifier to control the access of a network interface controller (NIC), which we often call a network adapter.
Your device — be it a computer, a tablet, or a phone — can connect to the Internet because it has a NIC. This NIC comes in the form of a Wi-Fi adapter, an Ethernet adapter (wired), or a cellular modem.
A MAC address consists of six groups of two characters (numbers or letters). Depending on where you view the address, these groups are separated by colons, hyphens, or nothing at all.
That said, here is a typical MAC address as shown on a Windows computer: D4-FB-6A-7C-31-B4. (This is a random address I made up for this post. If it belongs to an actual device, that’s just a coincidence.) This same address can also appear as d4:fb:6a:7c:31:b4 or D4FB6A7C31B4, depending on what platform or application you use to view it.
As you might have noticed, MAC is not case-sensitive, but it tends to appear either all lower case or all upper case. Each time you change a digit or a letter, you’ll get a new MAC.
Things to keep in mind about MAC
Here are some interesting facts about the MAC address.
- Every network adapter must have a MAC.
- A MAC is unique and permanent. It’s embedded in each networking adapter by the manufacturer. It’s like the vehicle identification number (VIN) of a car.
- Take “permanent” with a grain of salt because, just like a VIN, it’s susceptible to modification. More below.
- Eventually, we’ll run out of MAC addressing space. But considering this is a 48-bit scheme with a total of 281,474,976,710,656 — that’s 281 trillion and then some hundred billion more — possible addresses, it’s safe to say many things more consequential, like humanity or hopefully just the need for the MAC itself, would expire before we have to worry about a MAC shortage.
- There are many other names for a MAC address. Here a few examples: Physical address, basic service set identifier (BSSID), Ethernet hardware address (EHA), hardware address, and adapter address.
Generally, a device has its MAC on its label. It’s not a secret; everyone can see it — again, it’s like the VIN of a car, it must be shown. Once the device is yours, however, it’s a good idea to keep this address secure. You’ll know why by the end of this post.
Usage: MAC address vs. IP address
If MAC is the VIN of a car, then the IP address is the license plate. Both are used to identify a car but at different levels and purposes. Specifically, you can’t register your vehicle (and get a new license plate) if it doesn’t have a VIN.
The use of a MAC address
A DHCP server (like your router) uses a MAC address to assign an IP address to a network adapter. Without MAC, an adapter can’t get an IP address. Without an IP address, the device can’t connect at all.
You can also use the MAC to reserve a particular IP address for an adapter within a local network. When this happens within the network, the device will get the same IP address each time it connects. This IP reservation feature is quite useful for advanced network applications.
Conversely, you can also use MAC to deny (or explicitly allow) access to an adapter via MAC filtering, a kind of a security feature. “Kind of” because it’s not absolutely secure since you can actually “change” this address as shown below.
For the most part, though, when you don’t do anything, a MAC address is permanent. Consequently, if someone knows your device’s MAC (like your phone’s), they can potentially keep track of you — both at local (LAN) and Internet (WAN) levels.
(For this reason, by default, some modern mobile devices automatically use a temporary random “virtual” MAC address when it connects to a new Wi-Fi network.)
And that’s also the reason, now and then, you might want to change your device’s MAC.
Reasons you might want to change your MAC
Take “change” with a loose meaning of the word. It’s more of a spoofing than changing since this is done at the software level. Depending on how you apply the change, the real MAC will be restored when you restart or reset the device.
Still, here are a few occasions where you might want to change your device’s MAC.
- You want to re-use an already-approved MAC address on a new device — the reason many routers have a “MAC clone” feature. (By the way, in this case, on the reverse, if you change the MAC of an approved device, it will be disconnected.)
- You know your computer has been blocked or restricted from a network and want to sneak through. (Sorry, daddy! Your Parental Control settings will no longer be in effect!)
- You’re about to join a new network — like a public Wi-Fi — and don’t want folks to know your device’s real MAC.
And, finally, you don’t need any reason. You can change the MAC for the hell of it because you can. That’s, of course, if you know how to figure out that of your device.
How to figure out your device’s MAC
There are many ways to find out a device’s MAC address, depending on the device type. For example, on a router or a modem, the address is generally on the underside of the hardware itself. Just flip it up and take a close look.
But most of the time, we need to figure this out via software, like the operating system of the device.
So, on a mobile device (like a phone) tends how this in the “About Device” area of the operating system.
You can find out about the MAC on computers the way you find out your current IP address. Since MAC and IP are closely related, the two are almost always stored next to each other. In other words, if you see the IP, chances are the MAC is around.
Pro tip: If your computer has two NICs (one for Wi-Fi and one for Ethernet), here’s how to know which MAC address belongs to which NIC: Connect one of the NICs to a network, only that one will also have an IP address.
How to change a device’s MAC address
Now that you know what a MAC is and where to locate it let’s find out how you can (temporarily) change it.
By the way, unlike a VIN, it’s not illegal to alter your device’s MAC address. That’s probably because you really cannot permanently change a device’s MAC address anyway.
What you can do is disguise a NIC’s real MAC address as another using software. This change is temporary. When you reset (or re-install) the application, or move the NIC to a different device, or sometimes even restart the device, its real MAC address will return.
Again, that said, keep in mind the limited sense of the word “change” in this case. I’d say “MAC spoofing” is a more accurate choice of expression.
There are many different types of networking devices, of which some you can change the MAC address, some you can’t. Generally, though, you can change the MAC of a router or a computer. And that’s probably all we’d need to do anyway.
How to change the MAC address of a router
It’s only possible to change a router’s MAC address if the router has the MAC Clone feature — most routers do.
In this case, all you have to do is log into the router’s web interface, navigate to the WAN (Internet) setting area and choose to enter a new MAC address — whichever you want as long as it fits the format.
Or you can choose to clone the MAC of the computer you’re using. After that, apply the change, and the router will carry that MAC address until you reset it to default factory settings.
How to change the MAC address of a Windows computer
There are many ways to change the MAC on a Windows computer. The following is the easiest way. You need to use an account with administrator’s privilege.
- Click on the Start button, type in ncpa.cpl then press Enter, the Network Connections window will appear.
- Right click on the network adapter you want to work with and chose Properties. The Properties window of the connection will appear.
- Click on Configure button, then on the Advanced tab.
- Navigate to the “Network Address” (or “Locally Administered Address”) entry.
- Change the Value to a MAC address of your liking. It needs to be entered without any dash or colon, like this: D4FB6A7C31B4 then hit OK. By the way, if the new address doesn’t work out — some adapters can only take certain variations — just enter another one.
And that’s it, restart your computer, and your new address will apply. To undo this repeat steps from 1 to 4 then choose Not Present before clicking OK. Also, if you re-install Windows from scratch, the real MAC will be restored, too.
How to change the MAC address of a Mac computer
Again, there are a few different ways to change MAC on an Apple computer, but the following is the most convenient. Note that you need to log in a Mac with an Admin account for this to work.
- Determine the NIC you’re working with: This is called the interface name. If the computer has just one network adapter (all Wi-Fi-only computers are like that), then the interface name is always en0 (that’s en and zero). But if the machine has another NIC, its interface name will be en1 and so on. Determine which one’s MAC you want to change.
- Make sure the NIC is not being used: If this is an Ethernet NIC, disconnect the network cable. If it’s a Wi-Fi adapter, press and hold the Option key then click on the Wi-Fi icon (top right corner), then click on Disconnect from the current Wi-Fi network. Do not disable (turn off) the adapter!
- Call up Terminal: Use Spotlight (Command + Space bar) and then search for “Terminal” when found, click on it. The Terminal program will run.
4. Execute the MAC change command
Assuming you want to use our example MAC address above, the NIC’s interface name is en0. (If the device has more than one network adapter, you’ll also see en1, en2, and so on, with each representing a NIC.)
Now copy and paste the following command into Terminal, then press Enter (enter your account’s password, then press Enter again, if prompted):
sudo ifconfig en0 ether d4:fb:6a:7c:31:b4
Alternatively, you can use this command to create a random MAC address:
openssl rand -hex 6 | sed 's/(..)/1:/g; s/.$//' | xargs sudo ifconfig en0 ether
And that’s it. From this moment on your NIC will have a new MAC address. When you restart the computer, though, the NIC’s original MAC will return. To make the change persistent, you can write a startup script with the command above.
By the way, if you want to test if the new MAC is in effect, use this command:
ifconfig en0 | grep ether
It will show the current MAC address the adapter is using.
And that’s all there is to know about the MAC address. Most of the time, you won’t need to worry about it, but sometimes knowing how to change your MAC makes you feel like you have the power. It feels good.
By the way, if you ever wonder what will happen if two devices are sharing the same MAC address in a network. The answer is entirely predictable.
Though extremely rare, this can occur, and I have deliberately made that happen just for kicks. In this case, both devices will get the same IP address, and you’ll have an IP conflict situation, and neither device will get connected. Not good. Just pick another MAC address. There are plenty of them to choose from.