GUID (Globally Unique IDentifier)

Whilw surfing, I came across this term GUID and tried to understand it…. the following article is what I got…

A GUID (i.e. Globally Unique Identifier) is a unique reference number used as an identifier in computer softwares, widgets, web apps etc. The term GUID typically refers to various implementations of the universally unique identifier (UUID) standard.

Generally GUIDs are stored as 128-bit values, and are commonly displayed as 32 hexadecimal digits with groups separated by hyphens. The GUID consists of one group of 8 hexadecimal digits, followed by three groups of 4 hexadecimal digits each, followed by one group of 12 hexadecimal digits. There are different versions of GUIDs used having different properties which grant uniqueness through randomness. Since the total no. of GUIDs that can be generated is in the range of 1036, so the probability of same number getting generated twice is almost nil. The GUID structure stores a GUID.

Windows GUID structure

Here I am copying directly from official Microsoft site:


The syntax uses C++:

typedef struct _GUID {

DWORD Data1;

WORD  Data2;

WORD  Data3;

BYTE  Data4[8];




Specifies the first 8 hexadecimal digits of the GUID.


Specifies the first group of 4 hexadecimal digits.


Specifies the second group of 4 hexadecimal digits.


Array of 8 bytes. The first 2 bytes contain the third group of 4 hexadecimal digits. The remaining 6 bytes contain the final 12 hexadecimal digits.

The Windows access-control functions use GUIDs to identify the type of object that an object-specific ACE in an access-control list (ACL) protects. (To know more about ACE, click here). This way a script can activate any specific class or object without having to know the name or location of the dynamic linked library that contains it.

In Simple Terms

Yep! GUID can be pretty complex to understand. So, let’s make it easy:

The unique ID concept is used almost everywhere and I expect you to know this. In a database table, the Primary Key identity must be ‘locally unique’ i.e. different from other rows in that table, but can be same as the ID in other tables. For ‘locally unique’ situations a Primary Key kind of concept works fine but for defining an ID that must be unique globally (you may take it as a Primary Key that needs to be unique outside the table or even outside your control), GUIDs are used.

For example, anyone can create an ActiveX, and not know what other control someone else is using.. Now to keep them all distinct, ActivX uses GUIDs.

Time relation of GUID

GUIDs are a combination of the time (in very small fractions of a second so that it is assured to be different from other GUIDs defined earlier or to be defined later), and a number defining your location (sometimes taken from the MAC address of your network-card). So again it’s assured to be different from other GUIDs defined anywhere at any instance of time.

Text Encoding

A GUID is most commonly written in text as a sequence of hexadecimal digits separated into five groups, like:


This notation contains following fields, which are separated by hyphens:

Data1-has 8 hex digits-shown using ‘a’

Data2-has 4 hex digits-shown using ‘b’

Data3-has 4 hex digits-shown using ‘c’

Data4-has 16 hex digits-first 4 are shown using ‘d’ while for rest 12, ‘e’ has been used

For first three fields, the most significant digit is on the left. The last two fields are treated as eight separate bytes, again having most significant digit on the left and they follow each other from left to right. Also braces are often used to enclose the above format, so that it become:-


This format is called ‘Registry Format’.


Different flavours of GUIDs used in COM (Component Object Model) are:

  • IID – interface identifier; (registered on any system; stored in the Windows Registry at the key HKEY_CLASSES_ROOT\Interface)
  • CLSID – class identifier; (stored in the registry at HKEY_CLASSES_ROOT\CLSID)
  • LIBID – type library identifier;
  • CATID – category identifier; (its presence marks any class as belonging to some specific class categories)

DCOM (Distributed Component Object Model) introduces additional GUID subtypes:

  • AppID – application identifier;
  • MID – machine identifier;
  • IPID – interface pointer identifier; (applicable to any interface engaged in RPC)
  • CID – casuality identifier; (applicable to a RPC session)
  • OID – object identifier; (applicable to an object instance)
  • OXID – object exporter identifier; (applicable to an instance of the system object that performs RPC)
  • SETID – ping set identifier; (applicable to a group of objects)

These GUID subtypes may overlap, as the context of GUID usage defines its subtype. For example, a class may use some GUID as IID which was already in use by some other class as CLSID, but no two classes may have same CLSID.

And one more thing… a GUID element exists in some versions of the RSS specification, and a mandatory ID in Atom, which should contain a unique identifier for each individual article or weblog post.