Skip to content
BENIBIX Learn

Universally Unique Identifier (UUID)

Development📄 Files & FormatsData Formats

Also known as UUID, GUID, Globally Unique Identifier

A 128-bit ID any computer can make. Two almost never match.

Think of it like

Think of it like a name so long and odd that no one else has it.

Example

Lucy's notes app works offline on many phones. Each new note gets a UUID, so notes from every phone join up with no clash.

Why it matters

Many computers can make IDs at once without a clash. Nobody has to hand out the next number.

Definition

A UUID is a 128-bit number used as an ID that is unique everywhere. It is written as 32 hex digits in five groups joined by hyphens. Any computer can make one without asking a central list. The chance of two random UUIDs matching is tiny. Version 4 is fully random. Version 7 starts with the time, so newer IDs sort after older ones.

Example code

console
$ uuidgen
4149014e-eabb-4fab-a179-5177233cc0e5
A new random UUID. The 4 at the start of the third group marks version 4.
The UUID at the bottom is five groups of hex digits. No other computer will make the same one.

Common mistake

Using a UUID as a secret, like in a password reset link. Not every version is random, so some can be guessed.

Key takeaways

  1. 1
    128 bits. Written as 32 hex digits.
  2. 2
    No central list. Every computer makes its own.
  3. 3
    Versions differ. Version 4 is random, version 7 starts with time.

Learn it properly