UUID 生成器
一键生成随机 UUID v4(RFC 4122),可批量、可大写、可去连字符,用加密安全随机数。
UUID 由浏览器内置的加密安全随机数生成,全程本地计算,不上传任何内容。
中文介绍
UUID(通用唯一标识符)是一个 128 位的标识符,写数据库主键、生成会话令牌、给订单或埋点事件编号时常用。v4 版本完全靠随机数生成,无需联网、无需中心服务器就能保证几乎不可能重复。
这个工具用浏览器内置的加密安全随机数(Web Crypto)生成,可一次生成一个、也可批量生成,支持大写和去掉连字符两种格式。
常见问题
UUID v4 会重复吗?
v4 有 122 位随机数,组合数约 5.3×10³⁶(2¹²²)个。即便每秒生成 10 亿个、连续 100 年,撞一次的概率也约等于零,可放心当作唯一标识。
为什么 v4 的第 13 位总是「4」?
第 13 个十六进制字符是「版本号」,固定为 4 表示 v4。同理第 17 位固定为 8、9、a、b 之一,是 RFC 4122 规定的「变体」标记。
去掉连字符的 UUID 还合法吗?
合法,值完全相同,只是少了 4 个分隔符、变成 32 个十六进制字符。有些数据库(如 MySQL 的 binary 存储)或日志系统更偏好无连字符形式。
English
A UUID (universally unique identifier) is a 128-bit identifier commonly used for database primary keys, session tokens, and numbering orders or tracking events. Version 4 is generated purely from randomness, so it needs no network or central server yet is practically impossible to duplicate.
This tool uses the browser's built-in cryptographically secure random source (Web Crypto). Generate one at a time or in bulk, with uppercase and no-hyphen formats.
FAQ
Can two UUID v4 values collide?
A v4 has 122 random bits — about 5.3×10³⁶ (2¹²²) combinations. Even generating one billion per second for 100 years, the chance of a collision is essentially zero.
Why is the 13th character always "4"?
The 13th hex digit is the version number, fixed to 4 for v4. Likewise the 17th digit is always 8, 9, a or b — the RFC 4122 "variant" marker.
Is a UUID without hyphens still valid?
Yes. The value is identical — only the four separators are removed, leaving 32 hex characters. Some databases (e.g. MySQL binary storage) and log systems prefer the no-hyphen form.