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.
983fc123-321e-4116-8082-a01143ce7225
curl https://getuuid.sh/api/uuid