dev.ids
UUIDs, ULIDs and nano IDs; secure passwords and passphrases
Example results generated on 2026-10-08. Ones using
now,todayor randomness will differ when you run them: press Run on any example to run it in your browser, after editing it if you like.
Functions
| function | description |
|---|---|
uuid() | random v4 UUID |
password(len?: int) | a password of letters, digits and symbols (default 20 characters, about 6.5 bits each), from the OS’s secure generator |
passphrase(words?: int) | random words joined by dashes (default 6, about 9.4 bits per word), from the OS’s secure generator |
ulid() | a ULID: 26 characters that sort by creation time, then 80 random bits |
nanoid(len?: int) | a URL-safe random ID (default 21 characters, like a UUID’s strength) |
uuid_info(s: str) | version and variant of a UUID, plus its timestamp for v1 and v7 |
uuid
uuid(): random v4 UUID
uuid()
# → "25290c73-c247-44d4-8cc2-574c902c16f0"
password
password(len?: int): a password of letters, digits and symbols (default 20 characters, about 6.5 bits each), from the OS’s secure generator
password()
# → "yq5UBrw#@hAYLa-Jffg+"
password(12)
# → "-B9T4WoHm3_F"
See also: passphrase
passphrase
passphrase(words?: int): random words joined by dashes (default 6, about 9.4 bits per word), from the OS’s secure generator
passphrase()
# → "relay-chord-uncle-clay-whisk-sonic"
passphrase(4)
# → "roast-golf-rocky-booth"
See also: password
ulid
ulid(): a ULID: 26 characters that sort by creation time, then 80 random bits
ulid()
# → "01M4CZSHXCX3DPJS7B9G2Q2HW4"
nanoid
nanoid(len?: int): a URL-safe random ID (default 21 characters, like a UUID’s strength)
nanoid()
# → "X2nCYcws4jRaKm1tsi5qr"
nanoid(8)
# → "jK8Rjcv0"
uuid_info
uuid_info(s: str): version and variant of a UUID, plus its timestamp for v1 and v7
uuid_info(uuid())
# → {version: 4, variant: "RFC 9562"}
uuid_info("c232ab00-9414-11ec-b3c8-9f6bdeced846")
# → {version: 1, variant: "RFC 9562", timestamp: 2022-02-22 13:22:22 -06:00}
See also: uuid
More examples
ids
# UUID
uuid()
# → "e07bb2da-725c-4ea1-a949-f77903a4df13"
# when was this UUID made?
uuid_info("01890a5d-ac96-774b-bcce-b302099a8057").timestamp
# → 2023-06-29 22:34:18 -05:00
# sortable IDs
ulid()
# → "01M4CZSHXCE7CK6ZJ1SHVFCDY4"
# a strong password
password()
# → "fS7GbS*iei5e$EY2qE!C"
# one you can type
passphrase()
# → "quart-glove-heavy-decal-cocoa-alias"