skillfed

cuid2

Next generation GUIDs. Collision-resistant ids optimized for horizontal scaling and performance.

cuid2 v2.0.1 486.1K downloads/30d#6,391 on PyPI59
Permissive 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) Active released

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 cuid2

uv

uv add cuid2

poetry

poetry add cuid2

Installing 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

Development Status :: 5 - Production/StableIntended Audience :: DevelopersLicense :: OSI Approved :: MIT LicenseOperating System :: OS IndependentProgramming Language :: Python :: 3Programming Language :: Python :: 3.8Topic :: Security :: CryptographyTyping :: Typed

Tags

collision-resistant unique id generatordistributed guid generationsecure uuid alternativecuid2 pythonhorizontal scaling identifierscryptographic id generationoffline-compatible guid
distributed-systemsid-generationcryptography

More Cryptography packages