Generate random MAC addresses for network testing, virtualization, development, and security applications. Create customized, valid MAC addresses with specific vendor prefixes or formats. Perfect for system administrators, network engineers, and developers working with networking protocols.
A Media Access Control (MAC) address is a unique identifier assigned to a network interface controller (NIC) for use as a network address in communications within a network segment. This unique identifier is used in most IEEE 802 networking technologies, including Ethernet, Wi-Fi, and Bluetooth.
Bytes | Description | Example |
---|---|---|
First 3 bytes (0-2) | Organizationally Unique Identifier (OUI) - Identifies the manufacturer | 00:1A:79 (Cisco Systems, Inc.) |
Last 3 bytes (3-5) | Network Interface Controller (NIC) specific - Assigned by the manufacturer | 12:34:56 |
The first byte of a MAC address contains two special bits that define important properties:
Bit | Position | Meaning when set (1) | Example |
---|---|---|---|
I/G bit | Least significant bit of first byte | Multicast (Group) address | 01:00:5E:... (IPv4 multicast) |
U/L bit | Second least significant bit of first byte | Locally administered address | 02:00:00:... (Local address) |
When the I/G bit is 0, the address is a unicast (individual) address. When the U/L bit is 0, the address is globally unique (assigned by the manufacturer).
Generate MAC addresses for testing network equipment, DHCP servers, and network monitoring tools.
Create valid MAC addresses for virtual machines, ensuring they don't conflict with existing devices.
Test networking code and protocols with different MAC address types and formats.
Generate MAC addresses for testing network access control and MAC filtering capabilities.
Type | Description | Example |
---|---|---|
Unicast | Individual device address (I/G bit = 0) | 00:1A:79:12:34:56 |
Multicast | Group address (I/G bit = 1) | 01:00:5E:00:00:01 |
Broadcast | Special multicast address for all devices | FF:FF:FF:FF:FF:FF |
Locally Administered | Address set by local network admin (U/L bit = 1) | 02:00:00:00:00:01 |
Globally Unique | Manufacturer-assigned address (U/L bit = 0) | 00:1A:79:12:34:56 |
Here are examples of how to work with MAC addresses in common programming languages:
// Python - Get MAC address of network interface
import uuid
import socket
import fcntl
import struct
def get_mac_address(interface):
s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
info = fcntl.ioctl(s.fileno(), 0x8927, struct.pack('256s', bytes(interface[:15], 'utf-8')))
return ':'.join('%02x' % b for b in info[18:24])
# Example usage
mac = get_mac_address('eth0')
print(f"MAC address: {mac}")
// JavaScript - Generate random MAC address
function generateRandomMAC() {
const hexDigits = "0123456789ABCDEF";
let macAddress = "";
for (let i = 0; i < 6; i++) {
let byte = "";
for (let j = 0; j < 2; j++) {
byte += hexDigits.charAt(Math.floor(Math.random() * 16));
}
macAddress += (i !== 0 ? ":" : "") + byte;
}
return macAddress;
}
// Example usage
const mac = generateRandomMAC();
console.log(`Random MAC address: ${mac}`);