🖧 Random MAC Address Generator

Generate random MAC addresses for testing — locally-administered and unicast by default (bit pattern x2/x6/xA/xE in the first octet), so they won't collide with real vendor ranges.

Which bits are random and which are fixed

Six bytes come from crypto.getRandomValues, the browser's cryptographic source, then the first byte is forced into shape:

first = (random & 0xFC) | 0x02
bit 0 = 0  unicast, not a group address
bit 1 = 1  locally administered, not vendor assigned

That leaves the first octet ending in 2, 6, A or E - hence 02:... or 7A:.... Forty-six bits stay random, a pool of about 70 trillion, so a repeat only becomes more likely than not after roughly 10 million draws.

Options and where these belong

Randomising a real interface's MAC is a privacy feature, but two devices sharing an address on one LAN break each other's traffic.

Frequently asked questions

What is a locally administered MAC address?

One with the second-least-significant bit of the first octet set, marking the address as assigned by an administrator or a virtual machine rather than burned in by a manufacturer. Hypervisors use this range for the same reason.

Can a generated address clash with a real device?

Not with a vendor-assigned one, because manufacturers never set the local bit. It could clash with another locally administered address on the same segment, worth checking if you assign many by hand.

Why is the second character always 2, 6, A or E?

Those are the four low nibbles left once the multicast bit is cleared and the local bit is set. Any other value would mean a vendor prefix or a group address, neither safe for test data.