A UUID is 128 bits, but the standard 36-character text form is verbose. You can represent the same 128 bits in far fewer characters by encoding the raw bytes with Base64url or Base58, which keeps every bit while making the identifier shorter and URL-friendly.
Key takeaways
- Removing hyphens gives 32 chars; encoding the bytes gives ~22.
- Base64url (22 chars) and Base58 (~22 chars) are lossless and reversible.
- Shortening changes presentation only; store the canonical UUID when in doubt.
Three levels of shortening
The simplest shortening is cosmetic: remove the hyphens to go from 36 to 32 hexadecimal characters. To go shorter, encode the 16 raw bytes with a denser alphabet. Base64url encodes 128 bits in 22 characters and is URL-safe. Base58 (the alphabet used by many crypto and short-link systems) avoids ambiguous characters like 0/O and l/1 and lands around 22 characters too.
All of these are lossless: the original UUID can be reconstructed exactly, because you are re-encoding the same 128 bits rather than truncating them.
UUID : 123e4567-e89b-12d3-a456-426614174000 (36 chars)
No hyphen: 123e4567e89b12d3a456426614174000 (32 chars)
Base64url: Ej5FZ-ibEtOkVkJmFBdAAA (22 chars)What not to do
Do not shorten by truncating a UUID to its first few characters. Dropping bytes throws away entropy and dramatically increases collision risk. Shortening should always re-encode the full 128 bits, never discard them.
Also avoid inventing a custom scheme when a standard one works. Base64url and Base58 are widely understood and easy to reverse in every language.
When shortening is worth it
Shorter identifiers help in URLs, QR codes, filenames and anywhere the 36-character form is awkward. If you only need a compact display form, encode on the way out and store the canonical UUID internally so your database, logs and tooling stay consistent.
If you find yourself wanting a natively short identifier rather than an encoded UUID, compare UUID with Nano ID and ULID before committing.