What is UUID v4?
UUID (Universally Unique Identifier) v4 is a standard method for generating globally unique identifiers. Version 4 UUIDs are generated using random numbers, making them unpredictable and suitable for most general-purpose use cases. They follow RFC 4122 standards.
UUID Format
A UUID v4 follows this format: xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx
- 36 characters total: Including hyphens
- 32 hexadecimal digits: Plus 4 hyphens
- 5 groups: Separated by hyphens (8-4-4-4-12)
- Version digit: Always "4" in position 15
Why Use UUID v4?
- Globally Unique: Virtually impossible to generate duplicates
- Decentralized: No central authority needed for generation
- Random: Doesn't reveal generation timing or origin
- Standard: Widely supported across languages and databases
- Secure: Better than sequential IDs for privacy
Common Use Cases
- Database primary keys
- API resource identifiers
- Session and token IDs
- File and document IDs
- Distributed system identifiers
- User tracking and analytics