-
Notifications
You must be signed in to change notification settings - Fork 3
Predefined Formats
UCID comes with a rich set of predefined formats so you donβt have to memorize or manually configure every option. Whether you're mimicking UUIDs, generating short session tokens, or hashing-like IDs, UCID has you covered.
Predefined formats are shortcut aliases for common ID styles. Internally, they map to specific configuration presets β so calling ucid.format('uuid') is equivalent to passing a full config object.
Example:
ucid.format('uuid');
// Result: afe5791b-788a-0c72-dc61-34b008e3fd98Under the hood, this is equivalent to:
ucid({
octets: 5,
octetFormat: [8, 4, 4, 4, 12],
includeOnly: '1234567890abcdef',
});
// Result: afe5791b-788a-0c72-dc61-34b008e3fd98Each format supports multiple aliases for convenience. For example, 'uuid', 'uuidv4', 'universal', and 'universal-id' all point to the same configuration.
Hereβs a list of supported formats and their aliases:
-
uuid,uuidv4,universal,universal-id -
nanoid,nano,nano-id ksuidcuidulid-
snowflake,snowflake-id -
sha,sha1 sha256sha512md5-
object,objectid,object-id -
mongo,objectid24 objectid32-
digits,numeric alphanumericalpha-
ts-id,timestamp-id epoch-idjwt-idbcrypt-idargon-id-
host-id,machine-id session-id-
short,mini,ghost,phantom,ninja -
shortuuid,short-uuid,short-uuidv4 -
hex,hexadecimal -
shortucid,short-ucid snake-case-
separatorless,sepless,separator-less zuluslugdnaleet-
caps,capsid,caps-id wordy
ucid.format('uuid'); // uuidv4, universal or universal-id also works
// Result: dfe4e75c-c765-3cbe-012f-4e7651664b51
ucid.format('sha');
// Result: b216a7459df37c38b701ac2b5ad1ad5c634260f2
ucid.format('nanoid');
// Result: ejw86nXOHfVdAF47xNZBZ
ucid.format('cuid');
// Result: cisg9117yq8fn6xjsrjtdamxh
ucid.format('short-uuid');
// Result: a47031b5-5597-9828-65d1f632
ucid.format('mongo');
// Result: ea06fd984b10b1b03a672c54
ucid.format('ts-id');
// Result: 20250920-t315ny-d4huye
ucid.format('hex');
// Result: 9f5ada13-58cb5d69-4394f491-ee975ef8
ucid.format('short-ucid');
// Result: brxgx5ab-gwc1vvpa-osw3dm5c- Use predefined formats for consistency across environments.
- For hashing-like formats (
sha,md5, etc.), remember these are not actual cryptographic hashes β just structural mimics.
Next up β CLI
π unique-custom-id β most customizable ID generator you'll ever meet
π See our contributing guide for guidelines on how to contribute
π¬ Join the conversation on discussions
πͺͺ Licensed under MIT β free to fork, remix, and build upon
π Maintained by @calebephrem β contributions welcome!
β¨ Fork it. Tweak it. Make it yours.
- π Home
- π οΈ Usage
- π οΈ How To Use UCID
- π¦ Installation
- β Importing
- π Generate Simple ID
- π§© Configuration Options
- π§° Predefined Formats
- ποΈ Predefined Formats
- π§ Format Aliases
- π Format List
- π§ͺ Usage Examples
- β Remember
- 𧬠CLI
- π UCID CLI
- π Quick Start
- π CLI Options
- π§ͺ Examples
- πͺ£ Entropy Space