Your V1 UUID — Click to copy
UUID Anatomy
What is V1?
UUID v1 Generator — Complete Guide
UUID Version 1 is a time-based UUID that encodes the current timestamp as the number of 100-nanosecond intervals since October 15, 1582 (the start of the Gregorian calendar). It also includes a clock sequence to prevent duplicates when the clock is adjusted, and a node field that traditionally held the MAC address of the generating machine. UUID v1 was the original UUID version and is still widely used in legacy systems, Apache Cassandra, and some database applications.
RFC 9562 Definition: UUID v1 encodes a 60-bit timestamp (100ns intervals since Oct 15, 1582) split across three fields: time-low (32 bits), time-mid (16 bits), and time-hi-and-version (12 bits + 4-bit version). The clock-seq (14 bits) prevents duplicates on clock adjustment. The node field (48 bits) traditionally held the MAC address; UUIDCore uses a random node for privacy.
When to Use V1
UUID v1 is appropriate for legacy system compatibility, Apache Cassandra (which is optimised for time-based UUIDs), and situations where you need to extract the creation timestamp from the UUID itself. For new systems requiring sortable UUIDs, use UUID v7 instead — it provides the same time-ordering benefits without the security concerns of v1.
Advantages
- ✅ Time-ordered — sortable by creation time
- ✅ Timestamp can be extracted
- ✅ Well-supported in legacy systems
- ✅ Native support in Apache Cassandra
Considerations
- ⚠️ Exposes MAC address in original spec
- ⚠️ Complex timestamp format (100ns since 1582)
- ⚠️ UUID v7 is recommended for new systems
- ⚠️ Random node used by UUIDCore for privacy
UUID Structure
| Field | Bits | Description |
|---|---|---|
| time-low | 32 bits | Low 32 bits of the 60-bit timestamp |
| time-mid | 16 bits | Middle 16 bits of the timestamp |
| time-hi-and-version | 16 bits | 12-bit high timestamp + 4-bit version (0001) |
| clock-seq | 14 bits | Monotonic counter to prevent duplicates |
| node | 48 bits | MAC address or random (UUIDCore uses random) |
Code Examples
JavaScript
// Using the uuid library (npm) import { v1 } from 'uuid'; const uuid = v1(); console.log(uuid);
Python
import uuid # Generate UUID v1 my_uuid = uuid.uuid1() print(my_uuid) # Extract timestamp ts = my_uuid.time print(ts)
Java
// Using java-uuid-generator library import com.fasterxml.uuid.Generators; UUID uuid = Generators.timeBasedGenerator().generate(); System.out.println(uuid);
Apache Cassandra CQL
-- Cassandra natively uses UUID v1 CREATE TABLE events ( id timeuuid PRIMARY KEY, data text ); INSERT INTO events (id, data) VALUES (now(), 'event data');
Frequently Asked Questions
What is the difference between UUID v1 and v7? ▾
Both are time-ordered, but UUID v7 is recommended for new systems. UUID v7 uses a simple Unix millisecond timestamp, is easier to work with, and does not expose any machine information. UUID v1 uses a complex 100-nanosecond timestamp from 1582 and traditionally exposes the MAC address.
Can I extract the creation time from a UUID v1? ▾
Yes. The timestamp is encoded in the time-low, time-mid, and time-hi fields. To extract it: rearrange the three time fields in order (time-hi, time-mid, time-low), convert from 100ns intervals since Oct 15 1582 to Unix time. Most UUID libraries have a built-in method for this.
Is UUID v1 safe to use? ▾
UUID v1 can expose the MAC address of the server that generated it, which is a security and privacy concern. UUIDCore generates UUID v1 with a random node field for privacy. For new systems, UUID v7 is safer and more practical.
Why does Cassandra use UUID v1? ▾
Apache Cassandra uses a TimeUUID type based on UUID v1 because the timestamp allows efficient time-range queries. Cassandra has native support for extracting timestamps from TimeUUIDs. For new Cassandra deployments, some drivers now support UUID v7 as well.
Related Tools