UUID Generator

Generate one or more UUID values and copy the results directly from the output panel.

By Pankaj Kumar · DevToolsHub · Last updated Jun 2026

GUIDs in .NET: the decisions that actually matter

In .NET, UUIDs are called GUIDs (System.Guid) and are part of the BCL since .NET 1.0. I use them regularly as entity IDs in EF Core, as idempotency keys in outbound API calls, and as unique filenames for uploaded files in Azure Blob Storage. The generation is one line, but the decisions around storage format, database indexing, and which version to use in which context are where things get interesting and where bugs hide.

GUIDs in .NET and EF Core

Guid.NewGuid() generates a v4 (random) UUID using System.Security.Cryptography.RandomNumberGenerator internally. It is cryptographically random. The Guid struct provides multiple string format options relevant to interoperability:

// Generating GUIDs in .NET
Guid id = Guid.NewGuid();

// Standard dashed format (most common, lowercase)
string dashed = id.ToString();           // "550e8400-e29b-41d4-a716-446655440000"
string upper  = id.ToString("D");        // Same, uppercase if you use .ToUpper()
string nobrk  = id.ToString("N");        // "550e8400e29b41d4a716446655440000" (no dashes)
string braced = id.ToString("B");        // "{550e8400-e29b-41d4-a716-446655440000}"

// Parsing a GUID from a string (lenient — accepts all formats above)
Guid parsed = Guid.Parse("550e8400-e29b-41d4-a716-446655440000");
bool ok = Guid.TryParse(unknownInput, out Guid result); // safe for untrusted input

// EF Core: Guid properties become uniqueidentifier in SQL Server automatically
// For PostgreSQL (Npgsql), Guid maps to uuid
public class Order
{
    public Guid Id { get; set; } = Guid.NewGuid(); // client-side generation
    public string CustomerName { get; set; } = string.Empty;
}

This tool generates UUIDs client-side using the browser's crypto.randomUUID() API, which produces v4 (random) UUIDs. The result is identical to what Guid.NewGuid() produces in .NET — both use cryptographically secure random number generators.

UUID versions: which one to use in .NET projects

  • v4 (random) — Guid.NewGuid(): 122 bits of cryptographic randomness. Zero information about when or where it was generated. The default choice for entity IDs when database insert performance is not a concern.
  • v7 (Unix timestamp + random) — Guid.CreateVersion7() (.NET 9+): Combines a millisecond-precision Unix timestamp prefix with random bits. Time-sortable, so database rows sort chronologically by ID. Preferred for EF Core primary keys in high-insert-rate tables because it reduces B-tree index fragmentation compared to random UUIDs.
  • v5 (name-based, SHA-1): Deterministically generates a UUID from a namespace and a name. The same namespace + name always produces the same UUID. Useful for generating stable identifiers for known entities (e.g., a UUID for a specific external system's record ID) without a database lookup.
  • v1 (time + MAC address): Leaks the generating machine's MAC address and creation time. Avoid for new code.

UUID v4 collision probability

UUID v4 has 2122 possible values — approximately 5.3 × 1036. To reach a 50% probability of a single collision you would need to generate about 2.7 × 1018 UUIDs. At a rate of one billion UUIDs per second, that would take over 85 years. For all practical purposes, UUID v4 collisions are impossible.

How to generate a UUID online

  1. Set count to the number of UUIDs you need (1–100).
  2. Click Generate.
  3. Copy the result using the Copy button.

Five real .NET use cases

  1. Entity ID generation in EF Core without a database roundtrip. Set Id = Guid.NewGuid() in the entity constructor. EF Core writes it to the database on SaveChanges(). You know the ID before the INSERT — useful for event sourcing patterns where you need to reference the entity before it's persisted.
  2. Generating a unique file name for an uploaded file in Azure Blob Storage. Using the original file name as the blob name creates collisions for concurrent uploads of the same file. Use $"{Guid.NewGuid()}{Path.GetExtension(originalName)}" as the blob name.
  3. Generating an idempotency key for an outbound Stripe, Adyen, or Twilio API call. Store the GUID alongside the operation before the call, then pass it as the idempotency header. If the call times out and retries, the provider deduplicates and returns the original response.
  4. Generating a correlation ID for distributed tracing across multiple ASP.NET Core microservices. Generate a GUID at the entry point (API Gateway or first service) and pass it forward as an X-Correlation-ID header. Log it in every service for full request traceability.
  5. Creating a session or cart token for an anonymous user before they log in. Store the GUID in a cookie. On login, merge the anonymous cart into the authenticated user's account using the stored GUID to locate it.

GUIDs as SQL Server primary keys: the index fragmentation problem

Random v4 GUIDs fragment SQL Server's clustered B-tree index because each new row inserts at a random position rather than at the end. This causes frequent page splits, higher write amplification, and larger index sizes compared to sequential integers. Solutions in .NET: use Guid.CreateVersion7() (.NET 9) for time-ordered GUIDs, use NEWSEQUENTIALID() as the default value in SQL Server (though this only helps when the database generates the ID), or use an integer as the clustered primary key with a separate non-clustered unique GUID column.

Frequently asked questions

What is the difference between UUID and GUID? They refer to the same specification (RFC 4122). UUID is the standard term used in RFC 4122 and most programming languages. GUID is Microsoft's term for the same concept — System.Guid in .NET is a UUID.

Is Guid.NewGuid() in .NET cryptographically random? Yes. Since .NET Core, Guid.NewGuid() uses System.Security.Cryptography.RandomNumberGenerator internally, which is cryptographically secure. Do not use it as a replacement for tokens or secrets (too short at 122 bits), but it is suitable for IDs that must not be guessable.

How do I store a GUID as a string in SQL instead of uniqueidentifier? Use .HasConversion<string>() in your EF Core entity configuration. This stores the GUID as a 36-character VARCHAR. Note that string-format GUIDs don't sort the same way as uniqueidentifier in SQL Server, which can affect queries that rely on ID ordering.

This tool is built with ASP.NET Core 8, Blazor Server, and the Web Crypto API (crypto.randomUUID). It runs securely on Microsoft Azure.
Input Section

Generator settings

{
  "count": 5
}
Output Section

Generated UUID values

UUID result