Do you notice anything odd about the following list?

00000000-9b6d-4998-9dd7-6026894bdfba
11111111-9022-4400-bac2-8b66a9874443
22222222-a890-4dec-98bc-f41536b760bc
33333333-e361-4239-8d04-3f16f68ad9ce
44444444-d8c2-40ab-91bd-5a84511ed9d3
55555555-447a-4aa9-a51f-35c74a154156
66666666-193b-4ac3-bd92-860b6b49aedb
77777777-49de-4cc5-b9e6-2e5785dd47af
88888888-0d00-4672-933a-d68e240772be
99999999-7d9d-4d77-9e35-5e919db0f7d1
aaaaaaaa-76cd-4d6b-bae2-574e5b57c7ab
bbbbbbbb-6f9e-4d2d-ba11-64df5c7355fa
cccccccc-b897-4b15-9ab3-11b97836ce85
dddddddd-b417-48ad-8b5b-b762df75e03b
eeeeeeee-cc9c-4cb8-bae0-bbd4b10307fa
ffffffff-8d46-4a31-b297-2ac67dda3600

Yes, they are all legitimate Guids (Globally Unique IDs).  But each is also a Vanity Guid, which is a unique ID that has some recognizable pattern embedded in the Guid’s text representation.  A Vanity Guid is like a vanity license plate, only geekier.  You can use Vanity Guids for:

  • Branded software (e.g., your company or product ID)
  • Debugging (e.g., easily spot a specific Guid in a running program or long list of IDs)
  • Geek humor or insults

So how do you make a Vanity Guid?  Answer: The brute force (and easy) way is to create billions of Guids until you find one that meets your desired pattern. 

But why not just manually create whatever Guid you want, such as aaaaaaaa-aaaa-aaaa-aaaa-aaaaaaaaaaaa?  Answer: With a manual approach, you cannot guarantee the Guid is globally-unique.

In addition to obvious patterns, you can also embed words in Vanity Guids.  Of course, with a Guid you’re limited to hexadecimal digits (0-9,A-F).  But you can be creative and substitute numbers for letters, such as:

babeface-81f0-4a99-9e10-3ba203c54f4e
badb100d-0ea7-4208-bce9-043bb590e2c2
b19b00b5-3772-4a86-aece-0fe19729adf0

Following is a simple console program that generates Vanity Guids whose first block contains all the same character, as shown in the list at top.  The list is written to a text file and then opened in Notepad.

using System; 
using System.Diagnostics; 
using System.IO; 
using System.Text;

namespace CSharp411 
{ 
    class Program 
    { 
        static void Main( string[] args ) 
        { 
            StringBuilder sb = new StringBuilder(); 
            int count = 0;

            while (count < 10) 
            { 
                string guid = Guid.NewGuid().ToString(); 
                char c = guid[0];

                if (c == guid[1] && c == guid[2] && c == guid[3] && c == guid[4] && c == guid[5] && c == guid[6] && c == guid[7]) 
                { 
                    count++; 
                    sb.Append( guid ); 
                    sb.Append( "rn" ); 
                    Console.WriteLine( guid ); 
                } 
            }

            string path = @"C:tempGuids.txt"; 
            File.WriteAllText( path, sb.ToString() ); 
            Process.Start( "notepad.exe", path ); 
        } 
    } 
} 

Share and Enjoy:
  • Digg
  • Twitter
  • Facebook
  • Reddit
  • StumbleUpon
  • LinkedIn
  • Google Bookmarks
  • Slashdot