UUID v1 Generator
Generate UUID v1 — the original time-based UUID format combining a 100-nanosecond timestamp with a node identifier. Free, in-browser, no MAC address leaked.
Your V1 UUID
V1What is UUID v1?
UUID v1 is the time-based variant defined originally by RFC 4122 (now RFC 9562, May 2024). Its 128 bits encode:
- 60 bits — timestamp. 100-nanosecond intervals since the start of the Gregorian calendar (1582-10-15 UTC).
- 14 bits — clock sequence. Initialized randomly, incremented if the clock goes backwards.
- 48 bits — node ID. Originally the host's MAC address; modern implementations use a random value.
- 6 bits — version (4) and variant (2).
A typical v1 UUID looks like 6ba7b810-9dad-11d1-80b4-00c04fd430c8. The 11d1 in the third group identifies it as a v1.
Why is UUID v1 not lexically sortable?
RFC 4122 split the 60-bit timestamp into three fields and stored them "low, mid, high" — the most-significant timestamp bits ended up in the third group, which is the third part of the string representation. Sorting v1 UUIDs as strings therefore does not produce chronological order. UUID v6 was introduced to fix this by simply reordering the three timestamp fields to high-mid-low. UUID v7 went further and replaced the obscure 1582-epoch 100ns timestamp with a 48-bit Unix-epoch millisecond timestamp.
How to generate UUID v1 in your code
import { v1 as uuidv1 } from 'uuid';
const id = uuidv1();
// → '6c84fb90-12c4-11e1-840d-7b25c5ee775a'import uuid
id = uuid.uuid1()
# → '...some-time-based-uuid...'// java.util.UUID has no public v1 generator. Use a library:
import com.fasterxml.uuid.Generators;
UUID id = Generators.timeBasedGenerator().generate();CREATE EXTENSION IF NOT EXISTS "uuid-ossp";
SELECT uuid_generate_v1();