--- id: nanoid version: "2.0.0" license: MIT license_treatment: permissive maintenance: active --- # nanoid — A tiny, secure, URL-friendly, unique string ID generator for Python License: permissive · Maintenance: active · Downloads: 6.5M/mo ## What it is and what it does nanoid is a lightweight ID generator that produces cryptographically secure, URL-safe unique strings. It uses a larger alphabet (A-Za-z0-9_-) than UUID, reducing the default ID length from 36 to 21 characters while maintaining similar collision probability. The package offers both a secure default generator and a faster non-secure variant, and supports custom alphabets and lengths for tuning collision risk versus ID compactness. The library has no external dependencies and installs as a pure Python wheel, making it simple to add to any project. It's designed for scenarios where you need short, web-safe identifiers—such as URL slugs, database record IDs, or session tokens—without the overhead of UUID's longer format. Use it for: - Generate short, unique identifiers for database records or API resources that need to appear in URLs - Create session tokens or temporary identifiers for web applications where compactness matters - Build URL slugs or short links that are collision-resistant and safe to embed in query strings - Replace UUID in scenarios where the 21-character format is preferable to UUID's 36-character standard - Generate non-sequential IDs for distributed systems where collision probability is tuned to your scale ## Worth the install? AI-flagged interpretation of the facts above — verify before relying. Generates cryptographically secure, URL-friendly unique IDs shorter than UUIDs using an alphabet of A-Za-z0-9_- with configurable size and custom alphabets. Yes, if you need short, secure, URL-safe IDs. The package is lightweight, dependency-free, and actively maintained in its repository. The 2018 PyPI release date warrants verification that the version on PyPI matches your needs, but the active repository status and zero security vulnerabilities make it a solid choice for ID generation. ## Install pip install nanoid uv add nanoid poetry add nanoid ## Installing nanoid Before you install: Low friction: pure Python wheel with no runtime dependencies. Maintenance is active with recent commits, though the latest PyPI release is from 2018. License in practice: MIT license is permissive and imposes no restrictions on use, modification, or distribution in commercial or private projects. Quickstart: pip install nanoid from nanoid import generate generate() # => NDzkGoTCdRcaRyt7GOepg generate(size=10) # => "IRFa-VaY2b" generate('1234567890abcdef', 10) # => "4f9zd13a42" Verify before relying: - Whether the 2018 latest_release date reflects a genuine maintenance gap or if newer versions exist only in the repository - Specific collision probability guarantees for the default 21-character ID length - Performance characteristics compared to UUID generation ## Package facts - License: MIT (permissive) - Python support: unspecified - Install friction: low - Maintenance: active - Downloads: 6.5M/month (top 5,000 on PyPI) - Known vulnerabilities: none known ## Tags unique id generator, secure random id, url-friendly id, nano id python, uuid alternative, short unique string, collision-resistant id, id-generation, cryptography, url-safe [View on SkillFed](https://skillfed.io/packages/nanoid) · [View on PyPI](https://pypi.org/project/nanoid/)