Dan Schnau

I Need A GUID!

Click to copy; this guid is generated on each page refresh.

Why "I Need A GUID?"

Sometimes, when I'm working, I need to generate a GUID. I typically look for a web page do it for me. This GUID is generated with the C# command Guid.NewGuid().

What is a GUID?

GUID stands for "Globally Unique IDentifier" and is a randomly generated 128-bit value. The button above represents the guid as 32 hexadecimal values, each of which using four bits. Hexadecimal values range from 0 to F, with A-F representing 10 through 15.

They are also referred to as "UUID", with the first U for Universal. Typically in Microsoft tech we use the term "GUID" rather than "UUID", but they mean the same thing.

Why not use an integer for an ID?

In systems with any amount of distribution, sequential IDs may cause a problem where the same ID is generated twice by two different processes, causing a collision of data identifiers. That can mean a user sees data they shouldn't see or can't use their data at all.

GUIDs are generated with 128 bits so that the chance of a collision is about one in a billion. A collision of GUIDs is far less likely than winning the lottery, which is already miniscule.