What is a UUID?
A UUID (Universally Unique Identifier) is a 128-bit number used to identify information in computer systems. Version 4 UUIDs are randomly generated, making collisions virtually impossible — the probability of generating two identical v4 UUIDs is about 1 in 5.3 × 10^36.
UUID Format
A UUID is displayed as 32 hexadecimal digits in five groups separated by hyphens: xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx. The "4" indicates version 4, and "y" is one of 8, 9, a, or b.
Common Uses
- Database primary keys (PostgreSQL, MongoDB)
- Distributed systems where auto-increment IDs cause conflicts
- Session tokens and API keys
- File naming to avoid collisions
- Message queue deduplication