MAC Address Generator
A MAC (Media Access Control) address is a 48-bit hardware identifier assigned to network interfaces for communication at the data link layer. It is represented as six groups of two hexadecimal digits, separated by colons or hyphens (e.g., AA:BB:CC:DD:EE:FF). This generator uses the browser's built-in Web Crypto API to produce cryptographically random MAC addresses, with full control over the separator style, letter case, and first-octet bit flags.
The first octet of a MAC address encodes two critical bits: bit 0 (LSB) determines unicast (0) vs. multicast (1), and bit 1 indicates a globally unique OUI-based address (0) or a locally administered address (1). Locally administered MACs are useful for virtual machines, containers, and testing environments where you need randomized addresses that will never conflict with real hardware identifiers registered by manufacturers.
How it works
Each MAC is 6 bytes of cryptographic random data (crypto.getRandomValues). First-octet bit masking: bit 0 cleared → unicast; bit 1 set → locally administered. Bytes are formatted as two-hex-digit groups joined by the chosen separator (colon, hyphen, or none), then optionally uppercased.
Use cases
- Generating test MAC addresses for network simulation and lab environments
- Assigning random MACs to virtual machines and Docker containers
- Populating database seeds and mock network device inventories
- Testing network access control (NAC) and MAC filtering rules
- Creating anonymized MAC addresses for privacy-focused network configurations