URL safe UUIDs in the smallest number of characters

language-agnostic, uuid

Solution

Base-64 is good for this.

{098ef7bc-a96c-43a9-927a-912fc7471ba2}

could be encoded as

vPeOCWypqUOSepEvx0cbog

The usual equal-signs at the end could be dropped, as they always make the string-length a multiple of 4. And instead of `+` and `/`, you could use some safe characters. You can pick two from: `-` `.` `_` `~`

More information:

- RFC 4648

- Storing UUID as base64 String (Java)

- guid to base64, for URL (C#)

- Short GUID (C#)

Problem

Ideally I would want something like `example.com/resources/äFg4вNгё5`, minimum number of visible characters, never mind that they have to be percent encoded before transmitting them over HTTP. Can you tell a scheme which encodes 128b UUIDs into the least number of visible characters efficiently, without the results having characters which break URLs?

Original source

Related problems