creating a Universally Unique Identifier (UUID)

I was looking for a unique identifier for some work, and UUID (Universally Unique Identifier) comes to mind right away. What makes UUID so special is that practically (not guaranteed :)) they will be unique. This link talks about various ways a UUID can be generated.

Now for most of us, we want to generate UUIDs to work along with admiring it’s rich history. UUID (GUID has more inclination towards MS) can be generated using various ways:

  • On Internet, obviously using websites
  • Interactively
  • Programmatically

For Internet sites you can search and find various sources. I am going to concentrate on generating the same Interactively and Programmatically.

On Windows


UIDs can be generated from CLI by starting command prompt from Visual Studio (Tools – VS Command Prompt) and runuuidgen utility. This will dump a guid/uuid for you. Command line switches for uuidgen can be found here

If you have VS installed, the steps are very similar. Go to Tools – Create GUID. This will launch a dialog and you can generate UID in different formats. This invokes guidgen.exe

On MAC (Unix systems)

To generate UID from shell use uuidgen utility. Also UID generation is core part of CoreFoundation Framework. CFUUIDCreate is good reference for the same.

Or you can use uuidgen tool on terminal, this should work on systems confirming to UNIX specifications as well. I haven’t tried this on Linux but it should work.


Platform Independent

Most convenient would be to generate it programmatically on any platform. Here comes boost library, technically Qt also has support for UIDs but it is not free.