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()
# → "ca449926-a156-44c0-969e-a91a6575b974"
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()
# → "7=oDbbGNbMFarp!R$pAq"
password(12)
# → "7+CLAbaD^&WC"
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()
# → "diver-vocal-swamp-eagle-radio-lotus"
passphrase(4)
# → "focus-argue-drink-bulb"
See also: password
ulid
ulid(): a ULID: 26 characters that sort by creation time, then 80 random bits
ulid()
# → "01M4DSGJSK49SVAME8JNMHQSJJ"
nanoid
nanoid(len?: int): a URL-safe random ID (default 21 characters, like a UUID’s strength)
nanoid()
# → "dcecD0JN2UQg7bZKAnT-Z"
nanoid(8)
# → "HDMzFW6a"
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()
# → "d4dc5c1c-d6f6-44f7-9029-cdaf2c70834f"
# when was this UUID made?
uuid_info("01890a5d-ac96-774b-bcce-b302099a8057").timestamp
# → 2023-06-29 22:34:18 -05:00
# sortable IDs
ulid()
# → "01M4DSGJSM6MK7S20FN7QPEC97"
# a strong password
password()
# → "@3K*8K3VseVBfym8@=nf"
# one you can type
passphrase()
# → "chimp-dice-elbow-chain-noble-bunny"