In code
Generate a UUID in Kotlin
Kotlin reuses the JDK's java.util.UUID.
Kotlin example
Kotlin
import java.util.UUID
val 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.
8e1f58df-3163-462b-b39f-e2c2ece91c59
curl https://getuuid.sh/api/uuid