Back to Blog
🎲

What is a UUID?

When building applications, you constantly need to assign unique IDs to things: users in a database, items in a cart, or uploaded files. While auto-incrementing integers (1, 2, 3) work for simple databases, they fail miserably in distributed systems.

Enter the UUID

A UUID (Universally Unique Identifier) is a 128-bit label used for information in computer systems. It looks something like this: 123e4567-e89b-12d3-a456-426614174000

Why Are They So Great?

The magic of a UUID, specifically a Version 4 UUID, is that it is generated using random numbers.

The total number of possible UUIDs is $2^{122}$ (that's roughly $5 \times 10^{36}$). This number is so astronomically huge that you can generate a UUID locally on your laptop, and you are virtually guaranteed that it is unique across the entire universe, without ever having to check a central database.

When to Use Them

UUIDs are perfect for:

  • Database primary keys in distributed systems.
  • Temporary file names to prevent collisions.
  • Session IDs for user authentication.

Use a UUID generator to quickly grab a valid V4 identifier for your next project!

Try it yourself!

Put this theory into practice using our free, client-side tool.

Open Tool