Click here to Skip to main content
12,996,388 members (63,761 online)
Click here to Skip to main content
Add your own
alternative version

Tagged as


10 bookmarked
Posted 28 Jan 2014

MAC address and Network Interface Description

, 28 Jan 2014
Rate this:
Please Sign up or sign in to vote.
Finds the mac address and description of network interface


A Console Application that shows the MAC addresses and description of that Network interface card. This is for beginners who wants a quick solution for finding their MAC address.


MAC address (media access control address) is a unique identifier assigned to network interfaces for communications on the physical network segment. MAC addresses are used as a network address for most IEEE 802 network technologies, including Ethernet. Logically, MAC addresses are used in the media access control protocol sublayer of the OSI reference model.

MAC addresses are most often assigned by the manufacturer of a network interface controller (NIC) and are stored in its hardware, such as the card's read-only memory or some other firmwaremechanism. If assigned by the manufacturer, a MAC address usually encodes the manufacturer's registered identification number and may be referred to as the burned-in address (BIA). It may also be known as an Ethernet hardware address (EHA), hardware address or physical address. This can be contrasted to a programmed address, where the host device issues commands to the NIC to use an arbitrary address.

A network node may have multiple NICs and each must have one unique MAC address per NIC. 

Reference: Wikipedia  

Using the code 

The code is very simple, where a method GetMyMacAddress() returns a list of type string. Make sure to use the namespace "System.Net.NetworkInformation" - you can loop through NetworkInterface where it has the member method GetAllNetworkInterfaces().

Physical address can be retrieved from GetPhysicalAddress(). 

 private static List<string> GetMyMacAddress()
     List<String> slistMac = new List<string>();

     foreach (NetworkInterface nic in NetworkInterface.GetAllNetworkInterfaces())
         PhysicalAddress address = nic.GetPhysicalAddress();
         if ((NetworkInterfaceType.Tunnel != nic.NetworkInterfaceType)
              && !String.IsNullOrEmpty(address.ToString()))
             string sMac = string.Join(":", (from z in nic.GetPhysicalAddress()
                  .GetAddressBytes() select z.ToString("X2")).ToArray());
             slistMac.Add(String.Format("{0}\t {1}", sMac, nic.Description));

     return slistMac;
  Then you can display MAC by calling GetMyMacAddress() in your main Method
 foreach (string sMac in GetMyMacAddress())


This is the first version, Next could be display MAC using WPF..!


This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


About the Author

Vinayak Hegde (Vinnie)
Software Developer IBI Limited
United Kingdom United Kingdom
Being a human - I am a Coder, a Blogger, a Tweeter, a Son, a Brother and a human being..

You may also be interested in...

Comments and Discussions

QuestionMethod signature Pin
JV999929-Jan-14 3:09
professionalJV999929-Jan-14 3:09 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.

Permalink | Advertise | Privacy | Terms of Use | Mobile
Web02 | 2.8.170609.2 | Last Updated 28 Jan 2014
Article Copyright 2014 by Vinayak Hegde (Vinnie)
Everything else Copyright © CodeProject, 1999-2017
Layout: fixed | fluid