UUID Decoder and Timestamp Extractor
A UUID is more than a random string. Version 7 starts with a Unix timestamp in milliseconds, and versions 1 and 6 hold a timestamp and a node ID, so one ID in a log can tell you when a row was created. Paste UUIDs in any common form: hyphenated, 32 hex digits, {braces}, urn:uuid:, a PostgreSQL \x value or 22-character Base64. ULIDs work too. For each ID, the tool shows the version, the variant, the creation time and the other fields, and it explains why versions 3, 4 and 5 hold no time at all. It also converts between UUID, ULID and Base64, which share the same 128 bits. A UUIDv7 from PostgreSQL 18 carries more precision than uuid_extract_timestamp() returns, because uuidv7() stores a sub-millisecond clock in rand_a, and the tool shows that finer time as well. Enter dates or Unix timestamps and it works in reverse, giving the lowest UUIDv7 for each moment and a query on the primary key, so you can select a time range through the index without a created_at column. The version and timestamp logic was compared with uuid_extract_version() and uuid_extract_timestamp() on PostgreSQL 18.6 and checked against the RFC 9562 test vectors. Everything runs in your browser, so no IDs are uploaded.
Do more than uuid decoder and timestamp extractor — meet Chat2DB
Chat2DB is an AI-powered SQL client for Windows, macOS and Linux. Write SQL in natural language, format and optimize queries automatically, and manage MySQL, PostgreSQL, Oracle and 20+ other databases in one workspace.
How to use
- Paste UUIDs, ULIDs, dates or Unix timestamps, one per line, or click Generate for fresh UUIDv7 values.
- Enter the table and column used in the range query, then click Decode.
- Read the version, creation time and fields of each ID, or copy the range query. With two or more dates, the query covers the earliest to the latest.
Frequently asked questions
How do I get the timestamp from a UUID v7?
The first 48 bits are the Unix time in milliseconds, so take the first 12 hex digits and convert them to a number. For 017f22e2-79b0-7cc3-98c4-dc0c0c07398f, the value 017f22e279b0 is 1645557742000, which is 2022-02-22T19:22:22Z. PostgreSQL 18 has this built in: SELECT uuid_extract_timestamp('017f22e2-79b0-7cc3-98c4-dc0c0c07398f'). On older versions, use to_timestamp(('x' || substr(replace(id::text, '-', ''), 1, 12))::bit(48)::bigint / 1000.0). The time comes from the machine that generated the ID, which may be your application rather than the database.
Can you get the creation date from a UUID v4?
No. A version 4 UUID is 122 random bits plus 6 fixed bits for the version and variant, so it holds no time. Versions 3 and 5 are hashes of a name and hold no time either. Only versions 1, 6 and 7 carry a timestamp, and a version 8 UUID carries one only if its generator chose to. PostgreSQL gen_random_uuid() produces version 4, so its uuid_extract_timestamp() result is NULL. If you need creation times for existing v4 rows, they have to come from a created_at column, audit logs or a backup, and new rows can move to UUIDv7.
What is the difference between a UUID and a ULID?
Both are 128 bits, and both a UUIDv7 and a ULID start with a 48-bit Unix millisecond timestamp, so they sort by time. A ULID has no version or variant bits and uses all 80 remaining bits for randomness, and it is written as 26 Crockford Base32 characters instead of 36 hex characters and hyphens. You can store a ULID in a PostgreSQL uuid column, because the bytes fit, but a function that checks the version may then return NULL or a meaningless number. For a new schema, UUIDv7 is the standard choice. To inspect uuid columns and run these queries in a GUI, try Chat2DB: download it at chat2db.ai/download or open app.chat2db.ai.
