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.

6096fd22-080c-462f-a1e3-af8345785159
curl https://getuuid.sh/api/uuid

Other languages

← Full API reference