# UUID generator and decoder (v4, v7)

> Generate reproducible UUID v4 and v7 values from a seed, or validate any UUID or GUID and decode its version, variant and embedded timestamp.

Interaktive Version: https://www.calcopenly.com/de/programming/uuid-decoder-generator
Thema: Rechner für Programmierung und Technik

A UUID is a 128-bit identifier written as 32 hex digits in 8-4-4-4-12 groups. RFC 9562 fixes two fields in every standard UUID: the variant bits 10 at the start of the 17th hex digit, and a 4-bit version number in the 13th. The decoder reads both, then unpacks what that version carries: a 48-bit Unix millisecond timestamp for version 7, a 60-bit count of 100-nanosecond intervals since 15 October 1582 for versions 1 and 6, or 122 random bits for version 4.

The default is the RFC 9562 version 7 example, 017f22e2-79b0-7cc3-98c4-dc0c0c07398f, whose first 48 bits count 1,645,557,742,000 ms, which is 22 February 2022 at 19:22:22 UTC. Developers pick v7 for database keys because the values sort by creation time.

Generated UUIDs come from a seeded xoshiro256** generator, so the same seed always gives the same list. For identifiers that must be unguessable, use a cryptographic source such as crypto.randomUUID().

## Eingaben

- **I want to** (Optionen: Decode a UUID, Generate UUIDs)
- **UUID**: Upper or lower case, with or without hyphens, braces or a urn:uuid: prefix.
- **Version** (Optionen: v4 (random), v7 (time-ordered))
- **Seed**: A whole number from 0 to 2^64 − 1; the same seed always gives the same UUIDs.
- **How many**
- **Timestamp date (UTC)**
- **Timestamp time (UTC)**

## Ergebnisse

- UUID — Hauptergebnis
- Type
- Version
- Variant
- Embedded time
- Unix time (ms)
- Clock sequence
- Node
- Generated UUIDs

## Formel

$$
\begin{aligned} \text{v7: } t_{ms} &= \text{bits } 0\text{–}47 \\ \text{v1/v6: } t &= \frac{\text{60-bit count}}{10^7} \\ &\quad - 12\,219\,292\,800\ \text{s} \end{aligned}
$$

## Durchgerechnete Beispiele

### RFC 9562 version 7 example

- I want to: Decode a UUID
- UUID: 017F22E2-79B0-7CC3-98C4-DC0C0C07398F
- **UUID: 017f22e2-79b0-7cc3-98c4-dc0c0c07398f**
- **Version: 7**
- **Variant: RFC 9562**
- **Embedded time: 2022-02-22 19:22:22.000 UTC**
- **Unix time: 1645557742000 ms**
- Prüfquelle: RFC 9562 Appendix A.6 (Tuesday, February 22, 2022 2:22:22.00 PM GMT-05:00); Python 3.8: int('017F22E279B0', 16) = 1645557742000

### RFC 9562 version 4 example

- I want to: Decode a UUID
- UUID: 919108f7-52d1-4320-9bac-f847db4148a8
- **Version: 4**
- **Type: Random**
- **Variant: RFC 9562**
- Prüfquelle: RFC 9562 Appendix A.3; Python 3.8 uuid.UUID(...).version = 4, .variant = 'specified in RFC 4122'

### RFC 9562 version 1 example

- I want to: Decode a UUID
- UUID: C232AB00-9414-11EC-B3C8-9F6BDECED846
- **Version: 1**
- **Embedded time: 2022-02-22 19:22:22.0000000 UTC**
- **Clock sequence: 13,256**
- **Node: 9f:6b:de:ce:d8:46**
- Prüfquelle: RFC 9562 Appendix A.1; Python 3.8 uuid.UUID(...).time = 138648505420000000, (time − 122192928000000000) / 10^7 = 1645557742 s; .clock_seq = 13256; .node = 0x9f6bdeced846

### RFC 9562 version 6 example

- I want to: Decode a UUID
- UUID: 1EC9414C-232A-6B00-B3C8-9F6BDECED846
- **Version: 6**
- **Embedded time: 2022-02-22 19:22:22.0000000 UTC**
- Prüfquelle: RFC 9562 Appendix A.5 (same instant as the v1 example)

### Nil UUID with braces and a URN prefix (edge)

- I want to: Decode a UUID
- UUID: urn:uuid:{00000000-0000-0000-0000-000000000000}
- **UUID: 00000000-0000-0000-0000-000000000000**
- **Type: Nil UUID**
- Prüfquelle: RFC 9562 §5.9 (Nil UUID: all 128 bits zero) and §4 (urn:uuid: form)

### Max UUID (edge)

- I want to: Decode a UUID
- UUID: FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF
- **UUID: ffffffff-ffff-ffff-ffff-ffffffffffff**
- **Type: Max UUID**
- Prüfquelle: RFC 9562 §5.10 (Max UUID: all 128 bits one)

## Fragen

### What is the difference between UUID v4 and v7?

Version 4 fills 122 of the 128 bits with random data, so values are spread evenly and reveal nothing. Version 7, defined in RFC 9562 (May 2024), puts a 48-bit Unix millisecond timestamp first and 74 random bits after it, so new IDs sort in creation order. RFC 9562 notes that v4 has poor database-index locality, which is why v7 suits primary keys, at the cost of revealing when each ID was made.

### Can two random UUIDs collide?

In practice, no. A v4 UUID has 122 random bits, so by the birthday bound you would need about 2.7 × 10^18 of them for a 50% chance of a single duplicate, or about 103 trillion for a one-in-a-billion chance. Real collisions come from faulty random number generators or reused seeds, which is why the seeded UUIDs here shouldn't be used where uniqueness across systems matters.

### What is the difference between a UUID and a GUID?

They are the same 128-bit format; GUID is Microsoft's name for it. Microsoft tools often print GUIDs in upper case inside braces, such as {017F22E2-79B0-7CC3-98C4-DC0C0C07398F}, and RFC 9562 allows upper, lower or mixed case, so parsers should accept both. The one real difference is binary byte order: Windows stores the first three groups little-endian, which matters only when reading raw bytes.

### How do I get the timestamp from a UUID v7?

Take the first 12 hex digits, which hold a 48-bit count of milliseconds since 1970-01-01 00:00 UTC, and convert them to decimal. For 017f22e2-79b0-7cc3-98c4-dc0c0c07398f, 017f22e279b0 is 1,645,557,742,000 ms, which is 2022-02-22 19:22:22.000 UTC. The 48-bit field runs out in the year 10889, so it will not wrap in practice.

### Is a version 1 UUID a privacy risk?

It can be. Version 1 stores a 60-bit timestamp and a 48-bit node field that is traditionally the machine's MAC address, so the ID reveals when and on which network card it was made; the RFC 9562 v1 example decodes to 2022-02-22 19:22:22 UTC with node 9f:6b:de:ce:d8:46. RFC 9562 allows a random node value instead, and says to use version 7 instead of 1 or 6 where possible.

### Wie genau arbeitet „UUID generator and decoder (v4, v7)“?

Die Genauigkeit hängt von Ihren Eingaben und den Annahmen der Methode ab. Die Dezimalrechnung nutzt 50 signifikante Stellen, doch Schätzungen, numerische Verfahren und Quelldaten können ungenauer sein. Die angezeigte Rundung beseitigt diese Grenzen nicht. Anhand unabhängiger Quellen geprüfte Rechenbeispiele: 8. Beispielsweise wird „RFC 9562 version 7 example“ anhand von RFC 9562 Appendix A.6 (Tuesday, February 22, 2022 2:22:22.00 PM GMT-05:00); Python 3.8: int('017F22E279B0', 16) = 1645557742000 geprüft.

### Woher stammt die Methode?

RFC 9562 — Universally Unique IDentifiers (UUIDs), §4–5 and Appendix A test vectors; Blackman & Vigna — xoshiro256** and SplitMix64 reference code.

## Quellen

- [RFC 9562 — Universally Unique IDentifiers (UUIDs), §4–5 and Appendix A test vectors](https://www.rfc-editor.org/rfc/rfc9562)
- [Blackman & Vigna — xoshiro256** and SplitMix64 reference code](https://prng.di.unimi.it/)
