How the GUID Generator works
A GUID (globally unique identifier) is Microsoft's name for a UUID. Guid.NewGuid() in .NET and
NEWID() in SQL Server both create random version 4 values, and this tool does the same: 122 bits come
from your browser's cryptographically secure random generator (crypto.getRandomValues) and the
remaining bits mark the version and variant.
The formats match the .NET Guid.ToString format specifiers: D (hyphens),
N (digits only), B (braces) and P (parentheses). The C# format wraps each
value in new Guid("...") so it can be pasted into code, and the SQL formats produce either a
CAST to UNIQUEIDENTIFIER or a plain quoted literal for INSERT statements
and IN (...) lists. Choose Comma and new line to get a list you can paste straight into an array or
an IN clause.
How to use the GUID Generator
- Choose a format: D, N, B or P as in Guid.ToString, C# new Guid("..."), SQL Server CAST('...' AS UNIQUEIDENTIFIER) or a quoted SQL literal.
- Enter how many GUIDs you need (1 to 10,000) and pick a separator: new line, comma and new line, or comma and space.
- Tick Uppercase if your code style uses capital hexadecimal digits.
- Select Generate GUIDs, or press Ctrl + Enter (Cmd + Enter on a Mac), to create a new set, then copy the result or download it as a .txt file.
Example
Two GUIDs in the SQL Server format, separated by comma and new line (your values will differ):
CAST('6f9619ff-8b86-4d01-b42d-00c04fc964ff' AS UNIQUEIDENTIFIER),
CAST('0e984725-c51c-4bf4-9960-e1c80e27aba0' AS UNIQUEIDENTIFIER)
The same first value in other formats:
N: 6f9619ff8b864d01b42d00c04fc964ff
B: {6f9619ff-8b86-4d01-b42d-00c04fc964ff}
P: (6f9619ff-8b86-4d01-b42d-00c04fc964ff)
C#: new Guid("6f9619ff-8b86-4d01-b42d-00c04fc964ff")
Common use cases
- Adding fixed GUIDs to C# code, such as test data, constants or seed data for Entity Framework.
- Writing SQL Server INSERT statements or IN (...) lists for UNIQUEIDENTIFIER columns.
- Creating component or project GUIDs in braces for configuration files, installers or COM registration.
- Generating lists of IDs to paste into a C# array or collection initializer.
Frequently asked questions
Is a GUID the same as a UUID?
Yes. GUID is Microsoft's name for a UUID. Guid.NewGuid() in .NET and NEWID() in SQL Server create random version 4 values, which is what this tool generates.
What do the D, N, B and P formats mean?
They are the .NET Guid.ToString format specifiers. D is 32 digits with hyphens, N is 32 digits without hyphens, B wraps the D format in braces and P wraps it in parentheses.
Which format should I use in SQL Server?
A quoted literal such as '6f9619ff-8b86-4d01-b42d-00c04fc964ff' is converted automatically when it is inserted into or compared with a UNIQUEIDENTIFIER column. Use the CAST('...' AS UNIQUEIDENTIFIER) format where the type must be explicit, for example in a SELECT list or a UNION where there is no column to take the type from.
Does uppercase or lowercase matter?
No. GUIDs are compared by value, so both forms are equal in .NET and SQL Server. .NET writes lowercase by default and SQL Server displays uppercase.
How random are the GUIDs?
The random bits come from crypto.getRandomValues, the browser's cryptographically secure random number generator, and nothing is sent to our server.