cuid2
Next generation GUIDs. Collision-resistant ids optimized for horizontal scaling and performance.
What it is and what it does
cuid2 is a Python port of the CUID2 reference implementation, providing a generator for collision-resistant identifiers designed for distributed systems. Unlike UUIDs, CUIDs are optimized for horizontal scaling—you can generate IDs on multiple machines simultaneously without central coordination or network calls. The package offers both a simple wrapper for basic use and a configurable class for explicit control over ID length and generation parameters.
The library generates URL-friendly, non-guessable IDs that are secure against prediction attacks. It requires no external dependencies and works offline, making it suitable for applications that need unique identifiers across microservices, databases, or edge deployments where UUID collisions or coordination overhead are concerns.
Use it for:
- Generate unique identifiers for database records in distributed microservice architectures without a central ID service.
- Create collision-resistant session or request IDs across multiple application servers running in parallel.
- Build offline-first applications that need to generate unique identifiers without network connectivity.
- Replace UUIDs in systems where readability, URL-safety, or reduced collision probability are priorities.
- Assign unique IDs to events or logs in horizontally scaled systems without coordination overhead.
Worth the install?
AI-flagged interpretation of the facts on this page — verify before relying
Generates collision-resistant, cryptographically secure unique identifiers (CUIDs) optimized for distributed systems and horizontal scaling without coordination.
Yes. The package is lightweight, actively maintained, has no dependencies, and solves a real problem for distributed systems. MIT licensing is permissive. No known vulnerabilities. Install if you need collision-resistant IDs for horizontal scaling or prefer CUID2 properties over UUID.
Install
cuid2 on PyPI
pip
pip install cuid2uv
uv add cuid2poetry
poetry add cuid2Installing cuid2
Before you install
Low friction installation with no runtime dependencies. Actively maintained as of 2026-08-12 with stable production status.
License in practice
MIT license permits unrestricted use, modification, and distribution in both open and closed projects with minimal obligations.
Quickstart
pip install cuid2
from cuid2 import cuid_wrapper
cuid_gen = cuid_wrapper()
my_id = cuid_gen()
Requires Python 3.8 or later.
Verify before relying
- Actual collision probability and uniqueness guarantees under stated conditions
- Performance characteristics (generation speed, memory overhead) compared to UUID or other CUID implementations
- Whether cryptographic security claim is formally validated or audited
Package facts
| License | The MIT License (MIT) Copyright (c) 2023 Gordon Code Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"),… (full text in the JSON record) (permissive) |
| Python support | supports the current Python release (>=3.8) |
| Install friction | low — pure-Python wheel |
| Runtime dependencies | none |
| Maintenance | actively maintained — 850 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 486,138/month — #6,391 on PyPI (30-day window, as of 2026-08-14) |
| Known vulnerabilities | none known (OSV.dev, checked 2026-08-14) |
Evidence: cuid2-2.0.1-py3-none-any.whl
Keywords: crypt, security, uuid, guid, cuid, cryptography
Tags
More Cryptography packages
Certifi provides Mozilla's curated collection…
copyleft · top 100 on PyPI
cryptographycryptography provides cryptographic recipes and…
permissive · top 100 on PyPI
rsaPure-Python RSA encryption, decryption,…
permissive · top 1,000 on PyPI
pyOpenSSLpyOpenSSL wraps OpenSSL's SSL/TLS functionality…
permissive · top 1,000 on PyPI
azure-identityProvides Microsoft Entra ID token-based…
unclear · top 1,000 on PyPI
PyNaClPyNaCl provides Python bindings to libsodium…
permissive · top 1,000 on PyPI
cuidGenerates fast, sequentially-ordered unique…
permissive · top 5,000 on PyPI
py-machineidRetrieves the unique machine ID of a host…
permissive · top 5,000 on PyPI
uuidProvides UUID object creation and RFC…
unclear · top 5,000 on PyPI
nanoidGenerates cryptographically secure,…
permissive · top 5,000 on PyPI
ulidGenerates ULIDs (Universally Unique…
permissive · top 15,000 on PyPI
fastnanoidGenerates unique, URL-friendly string IDs using…
permissive · top 15,000 on PyPI
shortuuidGenerates concise, URL-safe unique identifiers…
permissive · top 1,000 on PyPI
uuid-v7Generates UUID v7 and v6 identifiers, extending…
unclear · top 15,000 on PyPI
sqidsSqids encodes numbers into short, unique,…
permissive · top 15,000 on PyPI
py-cidpy-cid encodes and decodes CIDs (Content…
permissive · top 15,000 on PyPI