Project Nayuki

Macshift (Nayuki’s version)


This Windows command-line application changes the MAC address of a given network adapter on the current machine to a random or given value. It can be used to impersonate other network adapters or bypass rate limiting (e.g. free Wi-Fi).

Macshift was originally written by Nathan True and released in . In the year 2022, I heavily cleaned up and modernized the C++ source code, and made small improvements to the functionality and messages. But the full credit goes to Nathan because never in a million years would I figure out how to use all those Windows APIs, especially the undocumented ones!


Executable: macshift.exe

Source code:

Help message

To avoid repeating myself, the following is what the program prints:

Macshift v2.0 - the simple Windows MAC address changing utility

Usage: macshift AdapterName [Options]

Example: macshift "Wi-Fi" -r
Example: macshift "Ethernet" -a 02ABCDEF9876

    -r               Use a random MAC address (default action).
    -a MacAddress    Use the given MAC address.
    -d               Restore the original MAC address.

    -h               Show this help screen.

Macshift uses special undocumented functions in the Windows COM Interface
that allow you to change an adapter's MAC address without needing to restart.

When you change a MAC address, all your connections
are closed automatically and your adapter is reset.


  • Administrator privileges are required! Also, run the built-in Windows program getmac to check the status of all network adapters before and after.

  • On a couple of machines I tested, not all MAC address values are acceptable. The lowest 2 bits of the leading byte have special meaning. The lowest bit is 0 for unicast or 1 for multicast, and the second lowest bit is 0 for universal or 1 for local. All adapters reject setting a multicast address. Wired Ethernet adapters accept universal and local addresses, whereas Wi-Fi adapters accept local addresses but reject universal addresses. Whenever an address is rejected, Windows simply reverts the adapter back to its hardware burned-in address. Due to these observed behaviors, Macshift generates random addresses that are unicast and local.

  • The program is tested to work on Windows 7, 8, and 10. It probably works on Windows Vista and 11. Unlike Nathan’s original program, mine won’t work on Windows XP due to new APIs being used.