Skip to content

In code

Generate a UUID in TypeScript

Identical to JavaScript — crypto.randomUUID() returns a typed string.

TypeScript example

TypeScript
const id: string = crypto.randomUUID();

No install? Use the tool or API

Here's a fresh version 4 UUID generated right now — copy it, or call the API from any language.

9a3aa59c-d74d-4414-9bba-e9f8a8261953
curl https://getuuid.sh/api/uuid

Other languages

← Full API reference