Skip to main content
Use crypto.randomUUID() to generate a UUID v4. This API works in Bun, Node.js, and browsers. It requires no dependencies.

In Bun, you can also use Bun.randomUUIDv7() to generate a UUID v7.

See Docs > API > Utils for more useful utilities.