# UUID Generator

> A UUID generator produces 128-bit identifiers that are unique without a central authority. Version 4 is fully random; version 7 embeds a millisecond timestamp in the leading bits so IDs sort chronologically and index far better as primary keys.

Source: https://rankcert.com/tools/uuid-generator
Free, no signup. Updated: 2026-08-29

## How to use it

1. Pick v4 for pure randomness or v7 for time-ordered IDs.
2. Choose how many you need.
3. Copy them out - generation uses your browser's crypto API, so the values never touch a server.

## Questions

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

v4 is 122 random bits. v7 puts a millisecond timestamp in the leading 48 bits, so IDs sort chronologically. Both are 128 bits and collision-safe in practice.

### Should I use a UUID as a primary key?

Use v7, not v4. Random v4 keys scatter inserts across a B-tree index, causing page splits and bloat. v7 appends in order, so it behaves much more like a sequential key.

### What are the odds of a collision?

For v4, you would need roughly 2.7 x 10^18 UUIDs before a 50% chance of one collision. It is not a practical concern.

### Are these random enough for security tokens?

They come from crypto.getRandomValues, so yes for identifiers. For session or reset tokens, generate them server-side and store a hash.

### Is UUID v7 safe to use in production yet?

Yes. It was standardised in RFC 9562 in 2024 and is supported by Postgres extensions, most ORMs and every major language's UUID library.

### Does a UUID v7 leak information?

It leaks the creation time to the millisecond, since the timestamp is in plain sight. That is usually harmless, but do not use v7 where the creation time is sensitive.

### UUID or ULID?

They solve the same problem. ULID is 26 characters in Crockford base32 and sorts lexically as a string; UUID v7 is the standardised, more widely supported equivalent. Prefer v7 unless you need the shorter text form.

### Should UUIDs be stored as text?

No. Store them as a native uuid type in Postgres or a 16-byte binary column in MySQL. Storing as a 36-character string roughly doubles the index size for no benefit.

## Related tools

- [Base64 Encode / Decode](https://rankcert.com/tools/base64-encode-decode): Encode text to base64 or decode it back, with full UTF-8 support and automatic handling of base64url input. Runs entirely in your browser.
- [Wildcard Mask Calculator](https://rankcert.com/tools/wildcard-mask-calculator): Convert a CIDR prefix or subnet into the wildcard mask Cisco ACLs and OSPF network statements expect, with the subnet mask and address range alongside it.
- [Diff Checker](https://rankcert.com/tools/diff-checker): Paste two versions of a text and see every added and removed line highlighted, computed in your browser with no upload.
- [CSV to JSON](https://rankcert.com/tools/csv-to-json): Turn a CSV into an array of JSON objects in your browser, with proper handling of quoted fields, embedded commas and custom delimiters.
- [JSON to CSV](https://rankcert.com/tools/json-to-csv): Convert a JSON array into a CSV you can open in Excel or Google Sheets, with headers taken from every key that appears.
- [Password Generator](https://rankcert.com/tools/password-generator): Generate strong random passwords in your browser using the Web Crypto API, with an entropy figure so you can see how strong they actually are.