Skip to content
πŸ› οΈToolsShed

MAC Address Generator

Generate random MAC addresses with vendor OUI prefix, format, and quantity options.

About this tool

A MAC address (Media Access Control address) is a unique identifier assigned to network interface cards, used to identify devices on a local area network. This tool generates random MAC addresses with support for specific vendor OUI prefixes, different formatting styles, and the ability to create multiple addresses at once. Whether you're testing network configurations, creating virtual machines, or simulating network environments, a MAC address generator saves time and ensures you have valid addresses without needing to remember format conventions.

To use the tool, select your desired MAC address format (colon-separated, hyphen-separated, or dot-separated notation), optionally choose a vendor OUI prefix from the dropdown to limit addresses to a specific manufacturer's range, and specify how many addresses you want to generate. Click the generate button, and the tool will instantly produce valid, random MAC addresses in your chosen format. You can copy individual addresses or all generated addresses at once for use in network testing, virtual machine configurations, or simulation scenarios.

This generator is especially useful for network engineers, system administrators, and software developers working with virtual environments or network simulations. The vendor OUI feature is helpful when you need addresses that appear to come from specific manufacturers, which is common in testing scenarios. Keep in mind that generated addresses are random and not registered to any real device; they are purely for testing and development purposes.

Frequently Asked Questions

Code Implementation

import random
import re

def generate_mac(format="colon", case="upper", uaa=True, multicast=False, oui=None):
    """Generate a random MAC address"""
    if oui:
        parts = [int(x, 16) for x in re.split(r"[:\-]", oui[:8])][:3]
    else:
        b0 = random.randint(0, 255)
        b0 = (b0 & 0xFE) if not multicast else (b0 | 0x01)  # unicast/multicast
        b0 = (b0 & 0xFD) if uaa else (b0 | 0x02)             # UAA/LAA
        parts = [b0, random.randint(0, 255), random.randint(0, 255)]

    parts += [random.randint(0, 255) for _ in range(3)]
    hex_parts = [f"{b:02x}" for b in parts]

    if format == "colon":
        mac = ":".join(hex_parts)
    elif format == "hyphen":
        mac = "-".join(hex_parts)
    else:
        mac = "".join(hex_parts)

    return mac.upper() if case == "upper" else mac

# Generate 5 random MAC addresses
for _ in range(5):
    print(generate_mac())

# With Apple OUI prefix
print(generate_mac(oui="00:1A:E3"))

# Locally administered
print(generate_mac(uaa=False))

Comments & Feedback

Comments are powered by Giscus. Sign in with GitHub to leave a comment.