hashids-python vs shortuuid
Python libraries for compact, URL-friendly identifiers
hashids-python encodes integers as reversible short strings, while shortuuid represents UUIDs as concise strings. The key difference is the source of the identifier: hashids-python works with integer values, and shortuuid works with UUIDs.

hashids-python: Turn Numbers into Shareable Hashes
hashids-python is a Python port of the JavaScript Hashids implementation, creating YouTube-like strings from one or more numbers. Use it to make database IDs less exposed in URLs, not as a security mechanism.

shortuuid: Generate Concise, URL-Safe UUIDs
shortuuid is a Python library built on Python’s uuid module that encodes UUIDs as concise, URL-safe strings using an unambiguous base57 alphabet. It also supports custom alphabets, deterministic version 5 UUIDs, and Django fields.
| hashids-python | shortuuid | |
|---|---|---|
| Language | Python | Python |
| License | MIT | BSD-3-Clause |
| Stars | 1.4k | 2.2k |
| Forks | 103 | 121 |
| Last analyzed | Oct 29, 2026 | Nov 11, 2026 |
Key differences
- hashids-python encodes one or more integers; shortuuid encodes existing UUIDs and can generate random or name-based version 5 UUIDs.
- hashids-python supports a salt, minimum output length, and custom alphabet; shortuuid uses a base57 alphabet by default and also supports configurable alphabets.
- hashids-python is intended to obfuscate IDs, not secure them; shortuuid provides compact representations of UUIDs, and truncating its output can increase collision risk.
- hashids-python is licensed under MIT; shortuuid is licensed under BSD-3-Clause.
- The supplied README information lists Python 2.7 and Python 3.5–3.8 for hashids-python, and Python 3.6+ for shortuuid.
- shortuuid includes a Django model field and command-line generator; hashids-python focuses on encoding and decoding integer IDs.
Choose hashids-python if you…
- need to encode one or more integer IDs as reversible strings.
- want to customize output with a salt, minimum length, or alphabet.
- need compatibility with a JavaScript Hashids generation.
Choose shortuuid if you…
- need concise representations of UUIDs for URLs, records, or user-facing references.
- want UUID generation, including random and name-based version 5 UUIDs.
- use Django and want a short UUID model field, or need a command-line generator.
Compare the numbers side by side, or add more projects
This comparison is generated with AI from the OSRepos analyses of both projects. Always check each project's repository and documentation before choosing.