Skip to main content

URL-friendly IDs for your app, like YouTube's.

Project description

Raison d'etre

GUID and UUID are not good ID schemes for the web because they are not designed for human consumption. They are too long and too hard to type, therefore not adequate for a URL. Youtube solved this problem perfectly with their 11-character video IDs, which:

  • are short,
  • are as easy to type as is realistic to hope for, and
  • contain a lot of information in them.

Now you wish to use the same scheme in your application.

  • Below is a specification. It is identical to what YouTube does, as far as we know. Let us call it "Livid".
  • This project contains implementations of the spec:
    • in Dart (TODO)
    • in Javascript (TODO)
    • in Python

Livid specification

Length and alphabet

Bit structure and payload

  • Encodes a 64-bit integer payload.
  • 11 Base64 characters ≈ 66 bits; only about 64 bits carry payload.
  • The last character is restricted to 16 possible values to zero out unused bits.

The regular expression pattern for valid IDs is [A-Za-z0-9_-]{10}[AEIMQUYcgkosw048].

Encoding process

  1. Generate a random 64-bit unsigned integer.
  2. Encode in Base64, producing an 11-character string.
  3. If the integer collides with an existing ID, regenerate. Collisions are extremely rare in such a large space.

Collision and randomness strategy

  • IDs are randomly generated, not sequential, to avoid enumeration, scraping, and privacy leaks (reddit.com).
  • Collision-checking ensures uniqueness.

Validity and guaranteed uniqueness


Summary table

Feature Description
Length Exactly 11 chars
Character set [A–Z][a–z][0–9][- _]
Encoded data 64-bit + 2 unused bits
End-char restrictions Only 16 values (last 2 bits zeroed)
Generation method Random + Base64 URL-safe encoding
Collision handling Check uniqueness, retry on conflict
Validation Query the server/API
Guarantee No official guarantee on format stability

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

livid-0.0.2.tar.gz (3.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

livid-0.0.2-py3-none-any.whl (4.1 kB view details)

Uploaded Python 3

File details

Details for the file livid-0.0.2.tar.gz.

File metadata

  • Download URL: livid-0.0.2.tar.gz
  • Upload date:
  • Size: 3.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/2.1.3 CPython/3.12.9 Linux/6.1.0-37-amd64

File hashes

Hashes for livid-0.0.2.tar.gz
Algorithm Hash digest
SHA256 932d64834d819bc6402c001740da23bbf1cbaa10e5fa752e06505079dcce28ab
MD5 712e8f5f9bc488cb3e41caa1a07e7d0d
BLAKE2b-256 4514b88ddccc4995a26739a0ca7ce2048b7f74b594a0acc4225c5e039fd6d57b

See more details on using hashes here.

File details

Details for the file livid-0.0.2-py3-none-any.whl.

File metadata

  • Download URL: livid-0.0.2-py3-none-any.whl
  • Upload date:
  • Size: 4.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/2.1.3 CPython/3.12.9 Linux/6.1.0-37-amd64

File hashes

Hashes for livid-0.0.2-py3-none-any.whl
Algorithm Hash digest
SHA256 e582412d52f84bc72bc7afe0b575a1adc11a964892e7eb08cc123b1f50b21fcc
MD5 c472d001e516aa5997288cf3c46c4c85
BLAKE2b-256 ce7f3f6184ce1d8d8cf677c444061e615cb72486aeeb520a0c8a8714354b9571

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page