A XUID is a short URL-friendly compressed UUID.
Awesome for database primary keys, urls and other identifiers


Frequently Asked Questions

What is a XUID?

A XUID is a URL-safe compressed UUID

How much shorter are XUIDs?

A UUID v4 is generally 36 characters. A XUID is 22 characters.

Are XUIDs just as unique as UUIDs?

A XUID is simply a compressed UUID. It holds just as much uniqueness as a full UUID, and can even be decoded back into it's original UUID.

How do I convert a UUID into a XUID?

  1. Convert a UUID string into a 128 bit number
  2. Base64 encode this number
  3. Strip any trailing `=` signs on the right of the resulting base64 string
  4. Replace all `+` characters with `-`
  5. Replace all `/` characters with `_`

How do I convert a XUID into a UUID?

  1. Replace all `_` characters with `/`
  2. Replace all `-` characters with `+`
  3. Base64 decode this string into a number
  4. Convert this number into a hex string
  5. (optional) add dashes in appropriate places

Are there any programming libraries available?

Here's a list. Please send us a message if you know of any new libraries: