UUID 生成器

批量创建随机 UUID/GUID 值。

// about

工具介绍

UUID(或 GUID)是由数字和字母组成的 36 位唯一标识码。它常用于给文件、数据库记录或账号命名,确保任何两项都不会混淆。

如何使用

  1. 选择您需要的 UUID 数量(1 到 100)。
  2. 选择大写或小写字母样式。
  3. 点击“生成”并复制您的专属 ID。

人们为何使用此工具

  • 生成保证全局唯一的无重复 ID。
  • 一键批量生成多达 100 个 UUID。
  • 可根据项目要求自由选择大写或小写格式。

常见问题解答 (FAQ)

UUID 长什么样子?

如 123e4567-e89b-12d3-a456-426614174000,由连字号分隔的 36 位字符串。

生成的 UUID 会和别人重复吗?

从数学概率来看,重复的可能性几乎为零。

这里使用的是哪个 UUID 版本?

本工具创建基于随机数的 Version 4 (v4) UUID。

指南 · 数据 · 约 3 分钟

UUID 指南:v4 与 v7 的区别,以及用 UUID 作数据库主键

550e8400-e29b-41d4-a716-446655440000 这样的字符串随处可见,用来标识订单、文件和 API 请求。了解 UUID 是如何生成的,以及该选择哪个版本。

UUID(通用唯一识别码)是一个 128 位的标识符,任何人无需询问中央服务器就能生成不会冲突的 ID。微软称之为 GUID。现行标准是 2024 年发布的 RFC 9562。

UUID 的结构、各版本的区别、为什么实际上不会碰撞,以及为什么作为主键 UUID v7 正逐渐取代 v4。
阅读指南 →
用 AI 自己做

用 AI 亲手打造这个工具

想要自己的版本?把下面的任务提示词粘贴到 AI 聊天中,或将技能文件保存到 AI 编程助手。其中包含我们开发此工具时整理的功能、边界情况和测试用例。

提示词和技能以英文提供,AI 工具在任何语言环境下都能很好地理解。

AI 任务提示词

直接粘贴到 Claude、ChatGPT、Gemini 等 AI 聊天中即可。

You are an experienced full-stack web developer. Build a web tool called "UUID 生成器" that meets the requirements below.

## Goal

Build a generator for UUID v4 (random) and v7 (time-ordered).

## Core features

- Choose version v4 or v7
- Generate 1 to 1,000 at once
- Upper/lower case and with/without hyphens
- Output as lines, comma-separated or a JSON array
- Copy all

## Inputs

- Version, count, format options

## Outputs

- List of UUIDs
- Text in the chosen format

## Edge cases and handling rules

- Keep v7 values sortable even within the same millisecond
- Prevent counts above the limit
- Fallback for browsers without crypto.randomUUID
- Set version and variant bits according to RFC 9562

## Implementation requirements

- Build it as a single page (HTML, CSS, JavaScript) that runs entirely in the browser, and never send the user's input to a server.
- Make the UI responsive and easy to use on mobile; label every input and keep everything keyboard accessible.
- Add a Copy button for results and show clear, friendly error messages for invalid input.
- Keep the core logic in functions separate from the UI so it can be unit-tested.

## Definition of done (test cases)

- The third group of a v4 UUID starts with '4'
- Several v7 values sort in creation order
- Removing hyphens yields 32 characters

First outline your implementation plan in at most five lines, then write the complete code, and finally explain how to check the test cases above.

技能 (SKILL.md)

在 Claude Code 等 AI 编程助手中保存为 .claude/skills/build-uuid-generator/SKILL.md,以后开发或修改此工具时可重复使用。

---
name: build-uuid-generator
description: Use when building or changing a UUID 生成器 tool. Build a generator for UUID v4 (random) and v7 (time-ordered).
---

# Build: UUID 生成器

## Goal

Build a generator for UUID v4 (random) and v7 (time-ordered).

## Workflow

1. Review the required features, inputs and outputs below and ask about anything missing first.
2. Implement the core logic as pure functions separate from the UI.
3. Check the logic against the test cases in the verification list.
4. Build a responsive UI with an input form, a result area and a Copy button.
5. Reproduce each edge case listed under Rules and refine the error messages.

## Core features

- Choose version v4 or v7
- Generate 1 to 1,000 at once
- Upper/lower case and with/without hyphens
- Output as lines, comma-separated or a JSON array
- Copy all

## Inputs

- Version, count, format options

## Outputs

- List of UUIDs
- Text in the chosen format

## Rules

- Keep v7 values sortable even within the same millisecond
- Prevent counts above the limit
- Fallback for browsers without crypto.randomUUID
- Set version and variant bits according to RFC 9562
- Build it as a single page (HTML, CSS, JavaScript) that runs entirely in the browser, and never send the user's input to a server.

## Verification

- [ ] The third group of a v4 UUID starts with '4'
- [ ] Several v7 values sort in creation order
- [ ] Removing hyphens yields 32 characters

交给 AI 时的小技巧

  • 在第一行写明技术栈(如 React、Vue 或纯 HTML),生成的代码会更贴合你的项目。
  • 在接受代码前,请让 AI 运行列出的测试用例并展示结果。
  • 不要把真实密码、客户数据或 API 密钥粘贴到提示词中,请用示例值代替。