Skip to content
dz / ulid-to-timestamp

ULID & UUID v7 to timestamp

Paste a ULID or a time-based UUID into the decode box – the embedded date is shown in UTC and your local time.

/uuid

Generate

Result

Generated in your browser from crypto.getRandomValues() – IDs are never sent anywhere. Bulk UUID v7 and ULID keep strict sort order, even within the same millisecond.

Decode

Shows version, variant and the creation time of v1, v6, v7 and ULIDs.

Where the time is stored

A ULID is 26 characters of Crockford Base32. The first 10 characters are a 48-bit Unix time in milliseconds, the remaining 16 are random:

01ARZ3NDEK  TSV4RRFFQ69G5FAV
└ time ──┘  └── random ────┘
01ARZ3NDEK → 1469922850259 ms → 2016-07-30T23:54:10.259Z

A UUID v7 stores the same 48-bit millisecond timestamp in its first 12 hex digits. Older v1 and v6 UUIDs use 100-nanosecond steps since 1582 – the decoder understands those too.

Decoding in code

// ULID – JavaScript
const A = '0123456789ABCDEFGHJKMNPQRSTVWXYZ';
const ms = [...ulid.slice(0, 10).toUpperCase()].reduce((n, c) => n * 32 + A.indexOf(c), 0);
new Date(ms);

// UUID v7 – JavaScript
new Date(parseInt(uuid.replace(/-/g, '').slice(0, 12), 16));

Questions

Can a ULID be stored in a UUID column?

Yes – both are 128 bits. The decoder shows the ULID as a UUID and converts a UUID back to ULID notation.

My UUID shows no date – why?

Only versions 1, 6 and 7 contain a timestamp. Version 4 is fully random and version 3 / 5 are hashes of a name.

How precise is the time?

Milliseconds for ULID and UUID v7. It is the time the ID was generated, by the clock of the machine that generated it.

▸ About this tool

About the UUID / ULID Generator

Introduction

A UUID (Universally Unique Identifier, called GUID in the Microsoft world) is a 128-bit number written as 36 characters, such as 0192f3c4-7a1b-7c3e-9d2f-6b8e4a1c5d07. Any computer can create one without asking a central server, and the chance that two of them ever collide is so small it can be ignored. That makes UUIDs the standard choice for database primary keys, request and trace IDs, file names, message queues and distributed systems. A ULID stores the same 128 bits in a shorter, 26-character form that sorts by creation time.

How to use it

  1. Pick UUID v4, UUID v7 or ULID. A fresh ID is created immediately.

  2. Set Count to create up to 10,000 IDs at once and press Generate (Ctrl + Enter).

  3. Choose the output: one per line, a JSON array, a ready-to-paste SQL IN (…) list, or comma-separated. For UUIDs you can switch to uppercase, remove the hyphens or add {braces} as used in Windows registry and .NET code.

  4. Paste any UUID or ULID into Decode to see its version, variant and – for time-based IDs – the exact moment it was created.

Short links: develzone.org/uuid, /guid, /uuid7 and /ulid. Pasting a UUID or ULID into the search box on the home page opens the decoder right away.

v4, v7 or ULID?

  • UUID v4 is 122 random bits. It reveals nothing about when or where it was made – ideal for public tokens and anywhere the creation time should stay private.

  • UUID v7 (RFC 9562, 2024) starts with the Unix time in milliseconds followed by random bits. New IDs are always larger than older ones, so database indexes stay compact and inserts stay fast – the main weakness of random v4 keys in PostgreSQL, MySQL and SQL Server. For new primary keys v7 is usually the better default.

  • ULID has the same idea as v7 – 48-bit timestamp plus 80 random bits – but is written in Crockford's Base32: 26 characters, case-insensitive, no hyphens and no easily confused letters (I, L, O, U). It is popular in event logs and URLs. Every ULID converts to a UUID and back without loss; the decoder shows both forms.

When many IDs are created in the same millisecond, this generator increments the random part instead of drawing a new one, so a bulk list is guaranteed to be in sort order.

What is inside a UUID

The 13th hex digit is the version (xxxxxxxx-xxxx-7xxx-… is a v7) and the 17th encodes the variant. Versions 1 and 6 contain a timestamp counted in 100-nanosecond steps since 15 October 1582 – the start of the Gregorian calendar – and a node ID that was historically the computer's MAC address. Versions 3 and 5 are hashes of a name, version 4 is random, version 7 is Unix time plus randomness and version 8 is left for custom layouts.

Privacy and randomness

All IDs are created in your browser with the operating system's cryptographically secure random generator (crypto.getRandomValues). Nothing is sent to a server, so the IDs you get have never been seen by anyone else. Keep in mind that v7 UUIDs and ULIDs reveal when they were created – use v4 if that matters.

Interesting facts

  • There are 2122 possible v4 UUIDs – about 5.3 × 1036. Generating a billion every second, it would take around 85 years to reach a 50 % chance of a single duplicate.

  • The first UUIDs were used in the Apollo Network Computing System in the 1980s and standardised in RFC 4122 (2005); RFC 9562 replaced it in 2024 and added versions 6, 7 and 8.

  • Need the time inside an ID in another format? The Unix timestamp converter turns the decoded milliseconds into any time zone.

❯ Esc
↑ ↓ select ↵ open Shift ↵ new line