Skip to content

In code

Generate a UUID in Java

java.util.UUID is part of the JDK.

Java example

Java
import java.util.UUID;

String id = UUID.randomUUID().toString();

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.

1971b4d2-cab1-49bb-968f-3f6efb6a04b6
curl https://getuuid.sh/api/uuid

Other languages

← Full API reference