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.

0b851a4a-11f6-4a3f-9109-bde62dd0497d
curl https://getuuid.sh/api/uuid

Other languages

← Full API reference