How to change ESP8266 MAC Address

This tutorial explains how to change mac address of ESP8266?¬†ESP8266 Arduino core does not provide an API to change ESP8266’s WiFi MAC address. While there is a WiFi.macAddress() function, it actually retrieves the current WiFi MAC address, instead of setting it. However, Espressif SDK offers an API to change the WiFi STA MAC address.

All esp8266 comes with unique address which is factory programmed. A MAC address is given to a network adapter when it is manufactured. It is hardwired or hard-coded onto your network interface card (NIC) or chip and is unique to it. Something called the ARP (Address Resolution Protocol) translates an IP address into a MAC address.

For this reason, the MAC address is sometimes referred to as a networking hardware address, the burned-in address (BIA), or the physical address. Here’s an example of a MAC address for an Ethernet NIC: 00:0a:95:9d:68:16.

In ESP8266 you can get the MAC address using simple command

Serial.println(WiFi.macAddress());

To change the MAC address you need core libraries of Espressif SDK that we can access in Arduino IDE using extern C function.

Example Program to change MAC address of ESP8266

This program prints the OLD and NEW MAC address of ESP8266 on Serial terminal, After uploading open serial monitor to see ESP8266 MAC address.

chaning esp mac address
MAC Addresss

One thought on “How to change ESP8266 MAC Address

Leave a Reply