sqids
Generate YouTube-like ids from numbers.
What it is and what it does
Sqids is a lightweight library for bidirectional conversion between numbers and short, unique, URL-safe identifiers. It takes one or more non-negative numbers and generates a compact string ID that can be decoded back to the original numbers. The library is designed for public-facing use cases like link shortening and event tracking, where you need readable IDs that don't reveal sensitive information but can be looked up quickly in a database.
The package offers several customization options: you can set a minimum ID length for uniformity, provide a custom alphabet to randomize output, and block specific words from appearing in generated IDs. It's implemented as a pure Python module with no external dependencies, making it simple to integrate. The algorithm is deterministic—the same input always produces the same ID—but the library explicitly warns that multiple different number sequences can theoretically decode to the same ID, so canonical verification may be needed in strict applications.
Use it for:
- Generate short, shareable links for public URLs without exposing internal database IDs
- Create event tracking IDs for internal systems that can be quickly decoded for database lookups
- Build URL-safe identifiers for APIs where sequential or predictable IDs are undesirable
- Encode multiple related numbers into a single compact token for reference in logs or reports
- Prevent profanity or blocked words from appearing in auto-generated public-facing IDs
Worth the install?
AI-flagged interpretation of the facts on this page — verify before relying
Sqids encodes numbers into short, unique, URL-safe IDs and decodes them back, with support for custom alphabets, minimum length padding, and profanity filtering.
Yes. Sqids is a straightforward, dependency-free library for a specific and common need—converting numbers to short IDs and back. It has no known vulnerabilities, permissive licensing, and broad Python version support. The aging maintenance status is not a blocker for a stable, focused tool. Install it if you need URL-safe ID generation; skip it if you need cryptographic security or true uniqueness guarantees.
Install
sqids on PyPI
pip
pip install sqidsuv
uv add sqidspoetry
poetry add sqidsInstalling sqids
Before you install
Low friction: pure Python wheel with no runtime dependencies. Maintenance status is aging (458 days since last release), but the package is stable and supports current Python versions.
License in practice
MIT license is permissive; you can use, modify, and distribute this package freely in commercial and open-source projects with minimal restrictions.
Quickstart
pip install sqids
from sqids import Sqids
sqids = Sqids()
id = sqids.encode([1, 2, 3]) # "86Rf07"
numbers = sqids.decode(id) # [1, 2, 3]
Note: multiple IDs can decode to the same number sequence; if canonical IDs matter, re-encode decoded numbers and verify the result matches.
Verify before relying
- Performance characteristics for encoding/decoding large batches of numbers or very large number values
- Whether the blocklist feature covers all common profanity or requires custom configuration for specific domains
Package facts
| License | MIT License Copyright (c) 2023-present Sqids maintainers. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the… (full text in the JSON record) (permissive) |
| Python support | supports the current Python release (>=3.6) |
| Install friction | low — pure-Python wheel |
| Runtime dependencies | none |
| Maintenance | aging — 458 days since the last release |
| First released | |
| Downloads | 614,336/month — #5,748 on PyPI (30-day window, as of 2026-08-14) |
| Known vulnerabilities | none known (OSV.dev, checked 2026-08-14) |
Evidence: sqids-0.5.2-py3-none-any.whl
Keywords: sqids, encode, generate, ids, hashids
Tags
More Utilities packages
Converts domain names between Unicode and…
permissive · top 100 on PyPI
charset-normalizerDetects and normalizes text encoding from…
permissive · top 100 on PyPI
setuptoolsSetuptools is a Python build backend and…
permissive · top 100 on PyPI
pluggyPluggy provides a plugin system that lets you…
permissive · top 100 on PyPI
PygmentsPygments is a syntax highlighter that colorizes…
permissive · top 100 on PyPI
sixSix provides utility functions to write Python…
permissive · top 100 on PyPI
hashidsGenerates short, unique, non-sequential hashes…
permissive · top 5,000 on PyPI
django-sqidsAdds a Django model field that encodes primary…
permissive · top 15,000 on PyPI
shortuuidGenerates concise, URL-safe unique identifiers…
permissive · top 1,000 on PyPI
nanoidGenerates cryptographically secure,…
permissive · top 5,000 on PyPI
django-hashidsProvides a Django model field that proxies…
permissive · top 15,000 on PyPI
snowflake-idGenerates and parses Snowflake IDs, distributed…
permissive · top 15,000 on PyPI
cuidGenerates fast, sequentially-ordered unique…
permissive · top 5,000 on PyPI
typeid-pythonGenerates and parses TypeIDs—type-safe,…
permissive · top 15,000 on PyPI
blurhashEncodes images into compact blurhash text…
permissive · top 15,000 on PyPI
python-codicefiscaleEncodes and decodes Italian fiscal codes…
permissive · top 15,000 on PyPI