My team builds software that allows MAC Addresses as user input. These addresses are often copy and pasted from various platforms in a variety of formats.

Wikipedia documents MAC Address Notational Conventions as:

The standard (IEEE 802) format for printing EUI-48 addresses in human-friendly form is six groups of two hexadecimal digits, separated by hyphens (-) in transmission order (e.g. 01-23-45-67-89-AB). This form is also commonly used for EUI-64 (e.g. 01-23-45-67-89-AB-CD-EF). Other conventions include six groups of two hexadecimal digits separated by colons (:) (e.g. 01:23:45:67:89:AB), and three groups of four hexadecimal digits separated by dots (.) (e.g. 0123.4567.89AB); again in transmission order.

While not as readable it is common to see MAC Addresses inputted in their raw form: AAAABBBBCCCC.

Given the common notations documented by Wikipedia and elsewhere we use the regular expression

^(?:[0-9A-Fa-f]{2}([-: ]?))(?:[0-9A-Fa-f]{2}\1){4}[0-9A-Fa-f]{2}$|^(?:[0-9A-Fa-f]{4}\.){2}[0-9A-Fa-f]{4}$

to match the following formats:


Someone recently directed me to the article Introduction to MAC Addresses With Formatting Examples which introduces the following format AAA.ABB.BBC.CCC, which our regex does not support.

After some research and googling I have not been able to attribute this format to a particular vendor or source. Before modifying our regex I'd like to have context on where the format comes from. Sadly the poorly sourced aforementioned article is within the first results for the Google search MAC Address Format.

During my research I have come upon several other formats that our regex does not match. Obviously there a variety of ways to represent a 48-bit MAC Address.

What are the various standard and industry practice ways to express a 48-bit MAC address? Since it is possible to break up a 12 character string with delimiters in several different places if possible I'd like to have a source for given formats.

  • 3
    Ultimately all punctuation in machine address formats get stripped out. They are solely there for human readability. So might I suggest just taking any input, stripping any whitespace and punctuation (colons and dashes etc) and then validating the result matches ^[0-9a-fA-F]{12}$ ?
    – wally
    Jan 15, 2019 at 21:00
  • AAA.ABB.BBC.CCC is mainly used by Cisco, a predominant vendor as you may know. So it is really useful to have this format included in your list.
    – JFL
    Jan 16, 2019 at 9:21

1 Answer 1


I really do not have all the sources for the various representations for 48-bit MAC addresses, but I have seen them variously used:


If I was building a regular expression for this, I would take all those formats into account, and I would make sure that mixed sizes and separators is not allowed. Oddly enough, I have not seen one represented as a single group of characters with no separators.

This has long been a pet peeve of mine, especially when I need to trace a MAC address through a network of various switches, routers, WAPs, etc., looking at ARP and CAM tables, and each device having a different representation in its tables.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.