A command-line utility based on cuid.net for generating collision-resistant ids. You can read more about CUIDs from the official project website.
dotnet tool install --global cuidgen.toolIf you prefer, cuidgen is also available as a portable binary for Windows, Mac and Linux for download from the Releases page.
cuidgen is designed to be as simple as possible and is perfect for usage in scripting.
Note
cuidgen by default generates CUIDv2 values with a length of 24 characters.
# Generate a default CUIDv2 (length 24)
$ cuidgen
ukzsdmvhjyhwb9mkguvwegbv
# Generate a CUIDv2 with a custom length
$ cuidgen -l 10
qrlkdu9vri
# Generate a CUIDv1
$ cuidgen -g 1
cmjmvcts200016437xe4i0jfu
# Generate multiple CUIDs at once
$ cuidgen -n 5
z1dimahkx6si6mzfumzz4lpr
vy0467zugnmo87kjdpao4r8d
qh410ftu8mb21iw8aqp5l600
czlgawafm116s2n4eyaqp8r3
g13maok93mbgdqruv7mr3djl| Argument | Description | Default | Valid Range |
|---|---|---|---|
-g, --generation |
Generation of CUID to generate (1 or 2) | 2 | 1-2 |
-l, --length |
Desired length of the CUID (only applies to CUIDv2) | 24 | 4-32 |
-n, --number |
Number of CUIDs to generate | 1 | 1-1000 |
-v, --version |
Display version information | - | - |
-h, --help |
Display help information | - | - |