uuid.lol

UUID v1 Generator

Press c to copy or r for a new one

Generate in bulk

What is UUID v1?

A v1 UUID is built from the time it was created and the identity of the machine that created it: a 60-bit count of 100-nanosecond intervals since 15 October 1582, a clock sequence, and a 48-bit node ID that is traditionally the network card's MAC address.

That means a v1 is not random and not private. Anyone holding one can read back roughly when and where it was made. Paste one into the decoder to see it happen.

Should you use v1 today?

Usually not. In a browser there is no MAC address to read, so the node ID here is random per session, which removes the one property v1 existed for.

If you want a time-ordered ID, v7 is the modern answer: it sorts better, encodes plain Unix milliseconds, and leaks nothing about the hardware.

If you are stuck with v1 data and only want it to sort, v6 holds the identical fields in a different order, so a v1 converts to a v6 and back with nothing lost.

Generate one in code

TypeScript

import { v1 as uuidv1 } from "uuid";

uuidv1();

Python

import uuid

uuid.uuid1()

Go

import "github.com/google/uuid"

id, err := uuid.NewUUID()

Rust

// uuid = { version = "1", features = ["v1"] }
use uuid::Uuid;

Uuid::now_v1(&[1, 2, 3, 4, 5, 6]);

SQL (MySQL)

-- MySQL's UUID() returns a version 1 UUID.
SELECT UUID();

What is a UUID?

A UUID is a Universally Unique IDentifier: a 128-bit number used to identify something without coordinating with anyone else. It is usually written as 32 hexadecimal characters in five hyphenated groups.

UUIDs come in several versions. v4 is random, v1 and v6 encode a timestamp and a MAC address, v3 and v5 hash a name inside a namespace, and v7 encodes a Unix millisecond timestamp followed by random bits.

Why use UUIDs?

UUIDs can be generated anywhere, by anyone, with no central authority, and still be safely assumed not to collide. That makes them useful for distributed systems, offline clients, and merging data from separate databases.

They are also instantly recognisable, which makes them easy to pick out of logs.

Some databases (for example Postgres) store a UUID as a 128-bit integer rather than a 36-character string, so using one as a primary key costs far less than it looks.

What are the downsides?

Uniqueness is probabilistic, not guaranteed. The odds of two v4 UUIDs colliding are negligible, but they are not zero.

Some versions leak information. A v1 or v6 UUID contains the MAC address of the machine that generated it and the moment it was generated, which is enough to correlate a device across systems. You can see exactly what a UUID gives away with the UUID decoder.

Time-ordered IDs are also partly guessable, so they are a poor choice for anything that doubles as a secret, such as a password reset token.