UUID生成器

生成唯一标识符(UUID) v1(基于时间戳)和v4(基于随机)。

选项
生成的UUID 1 UUID(s)
8995189c-7234-408b-bc0c-3752f971a1e1
关于UUID版本
UUID v1 基于时间戳,包含MAC地址和时间戳,可按创建时间排序。
UUID v4 基于随机,最常用,包含122位随机数。
What is a UUID?

A UUID (Universally Unique Identifier), also known as GUID (Globally Unique Identifier), is a 128-bit identifier that is unique across space and time. The standard representation is 32 hexadecimal digits displayed in five groups separated by hyphens (e.g., 550e8400-e29b-41d4-a716-446655440000).

UUID Versions

There are several UUID versions with different generation methods. UUID v1 uses timestamp and MAC address. UUID v4 uses random numbers and is most commonly used. UUID v3 and v5 use namespace and name hashing. Each version has specific use cases based on uniqueness requirements and privacy considerations.

Cron 解析器
  • Database primary keys in distributed systems
  • Session identifiers and tokens
  • File and resource naming
  • Tracking and correlation IDs in microservices
  • Unique identifiers in APIs
UUID Version Comparison
v1 Time-based: Uses timestamp + MAC address. Sortable but reveals creation time and machine.
v4 Random: Uses random numbers. Most common choice for general use. No information leakage.
Frequently Asked Questions

Are UUIDs truly unique?

While collisions are theoretically possible, the probability is astronomically low (1 in 2^122 for v4). You would need to generate 1 billion UUIDs per second for 85 years to have a 50% chance of collision.

Should I use UUID v1 or v4?

Use v4 for most cases as it doesn't reveal any information. Use v1 if you need time-sortable IDs and don't mind exposing creation timestamps.