fastnanoid
A tiny, secure URL-friendly, and fast unique string ID generator for Python, written in Rust.
What it is and what it does
fastnanoid is a Python library that generates short, unique, URL-safe string identifiers. It wraps a Rust implementation to provide performance gains over the original py-nanoid library. The package works as a drop-in replacement for py-nanoid's generate() function, requiring only a one-line import change.
The library also includes helper functions to convert between UUIDs and base64url-encoded strings, useful when you already have a UUID (from a database, for example) and want to display it as a compact string. It supports Python 3.8 through 3.13 and is available as pre-compiled wheels for most common platforms, though installation does require matching the correct wheel for your Python version and architecture.
Use it for:
- Generate short, unique IDs for database records or API resources as an alternative to sequential or UUID-based identifiers.
- Create URL-safe tokens for session management, API keys, or temporary access links without encoding overhead.
- Convert existing UUIDs to compact base64url strings for cleaner display in URLs or user-facing interfaces.
- Replace py-nanoid in existing projects where performance is a bottleneck in ID generation loops.
Worth the install?
AI-flagged interpretation of the facts on this page — verify before relying
Generates unique, URL-friendly string IDs using a Rust-backed implementation that is faster than the original py-nanoid library.
Yes, if you need fast, URL-friendly ID generation and are comfortable with compiled dependencies. The library is stable, permissively licensed, and actively maintained. Install friction is moderate due to Rust bindings, but wheels are widely available. Not necessary if you already use py-nanoid and performance is not a concern, or if you prefer pure-Python solutions.
Install
fastnanoid on PyPI
pip
pip install fastnanoiduv
uv add fastnanoidpoetry
poetry add fastnanoidInstalling fastnanoid
Before you install
Medium install friction due to compiled Rust bindings, but wheels are available for Python 3.8–3.13 across multiple platforms (Linux, macOS, Windows, and ARM architectures). Last release was 410 days ago; the repository is active but aging.
License in practice
Licensed under MIT (permissive), which allows commercial and private use with minimal restrictions.
Quickstart
pip install fastnanoid
from fastnanoid import generate
id_string = generate()
Requires Python 3.8 or later; compiled wheels must match your Python version and platform.
Verify before relying
- Whether the 2.8x speed claim versus py-nanoid holds across real-world workloads and ID lengths.
- How collision probability compares to standard nanoid implementations for production use cases.
- Whether the uuid conversion helpers (uuid_to_urlid, urlid_to_uuid) are stable and widely tested.
Package facts
| License | not declared (permissive) |
| Python support | supports the current Python release (>=3.8) |
| Install friction | medium — platform-specific wheel |
| Runtime dependencies | none |
| Maintenance | aging — 410 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 155,572/month — #10,808 on PyPI (30-day window, as of 2026-08-14) |
| Known vulnerabilities | none known (OSV.dev, checked 2026-08-14) |
Evidence: fastnanoid-0.4.3-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl; fastnanoid-0.4.3-cp310-cp310-manylinux_2_17_armv7l.manylinux2014_armv7l.whl; fastnanoid-0.4.3-cp310-cp310-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl; fastnanoid-0.4.3-cp310-cp310-manylinux_2_17_s390x.manylinux2014_s390x.whl; fastnanoid-0.4.3-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl; fastnanoid-0.4.3-cp310-cp310-manylinux_2_5_i686.manylinux1_i686.whl; fastnanoid-0.4.3-cp310-cp310-musllinux_1_2_aarch64.whl; fastnanoid-0.4.3-cp310-cp310-musllinux_1_2_armv7l.whl; fastnanoid-0.4.3-cp310-cp310-musllinux_1_2_i686.whl; fastnanoid-0.4.3-cp310-cp310-musllinux_1_2_x86_64.whl; fastnanoid-0.4.3-cp310-cp310-win32.whl; fastnanoid-0.4.3-cp310-cp310-win_amd64.whl; fastnanoid-0.4.3-cp311-cp311-macosx_10_12_x86_64.whl; fastnanoid-0.4.3-cp311-cp311-macosx_11_0_arm64.whl; fastnanoid-0.4.3-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl; fastnanoid-0.4.3-cp311-cp311-manylinux_2_17_armv7l.manylinux2014_armv7l.whl; fastnanoid-0.4.3-cp311-cp311-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl; fastnanoid-0.4.3-cp311-cp311-manylinux_2_17_s390x.manylinux2014_s390x.whl; fastnanoid-0.4.3-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl; fastnanoid-0.4.3-cp311-cp311-manylinux_2_5_i686.manylinux1_i686.whl
Keywords: nanoid
Tags
More Software Development packages
Provides backported and experimental type hints…
permissive · top 100 on PyPI
numpyNumPy provides an N-dimensional array object…
permissive · top 100 on PyPI
fastapiFastAPI is a Python web framework for building…
permissive · top 100 on PyPI
annotated-docProvides a way to document function parameters,…
permissive · top 100 on PyPI
typerTyper builds command-line applications from…
permissive · top 1,000 on PyPI
distlibDistlib provides low-level packaging utilities…
permissive · top 1,000 on PyPI
nanoidGenerates cryptographically secure,…
permissive · top 5,000 on PyPI
shortuuidGenerates concise, URL-safe unique identifiers…
permissive · top 1,000 on PyPI
ulidGenerates ULIDs (Universally Unique…
permissive · top 15,000 on PyPI
cuid2Generates collision-resistant,…
permissive · top 15,000 on PyPI
uuid-utilsFast UUID generation and manipulation for all…
permissive · top 1,000 on PyPI
ulid-pyGenerates and parses ULIDs (Universally Unique…
permissive · top 5,000 on PyPI
fastuuidFastUUID provides CPython bindings to Rust's…
permissive · top 1,000 on PyPI
types-nanoidProvides type hints for the nanoid package,…
permissive · top 15,000 on PyPI
timeflakeGenerates 128-bit, time-ordered, URL-safe…
permissive · top 15,000 on PyPI
uuidProvides UUID object creation and RFC…
unclear · top 5,000 on PyPI