October DealsAmazon USOctober deal check: compare before you payAmazon US: current deals, useful picks and tech finds.Check DealsSlow PC?RecommendedPC slow today? Run a repair scan before it gets worseResolve common Windows issues and optimize system performance.Scan NowOctober DealsAmazon USDeal season is back - check today's better picksAmazon US: current deals, useful picks and tech finds.See Picks×
Skip to content
World desk4 min

UUID Versions: Choose v7 for Time-Ordered IDs, v4 for Random Ones

UUIDv7 is the practical default for new time-ordered IDs when supported. Use v4 for random IDs and v5 for repeatable name-based identifiers; understand privacy, security, and runtime trade-offs before choosing.
Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

For a new system that needs IDs to sort roughly by creation time, choose UUIDv7 if your runtime has a reliable implementation. Use UUIDv4 when you want random IDs without timestamp ordering, and UUIDv5 when the same namespace and canonical name must always produce the same ID. UUIDv6 is mainly for systems transitioning from UUIDv1; UUIDs should never be used as authorization secrets.

What UUID versions mean

UUID version numbers describe different layouts and generation methods, not a ranking in which the highest number is automatically best. The current specification is IETF RFC 9562, published in May 2024, which supersedes RFC 4122. It defines versions 1 through 8.

As an Amazon Associate I earn from qualifying purchases.

Version How it is generated Best fit
UUIDv1 Timestamp, node identifier, and clock sequence Legacy systems; a MAC-based node may reveal network-address information.
UUIDv2 DCE security UUID format Specialized legacy uses.
UUIDv3 Deterministic name-based UUID using MD5 Compatibility with existing identifiers; RFC 9562 recommends v5 instead where possible.
UUIDv4 Random or pseudorandom bits, with version and variant bits set Random IDs when time ordering is unnecessary.
UUIDv5 Deterministic name-based UUID using SHA-1 Repeatable IDs from a stable namespace and canonical name.
UUIDv6 V1-compatible timestamp fields rearranged for improved database locality V1 transition or compatibility needs.
UUIDv7 Unix-epoch milliseconds in the most significant bits, followed by random data and optional monotonicity fields New IDs that should sort approximately by creation time.
UUIDv8 Custom or vendor-specific layout A documented custom design not met by a standard version.

The version names are also listed in Java’s official UUID API. UUIDv8’s uniqueness depends on its implementation-specific design; the version and variant bits alone do not guarantee it.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Choose the version for your requirement

For new IDs that should sort by creation time: UUIDv7

UUIDv7 places a 48-bit Unix-epoch timestamp in milliseconds in its most significant bits. The remaining 74 usable bits are normally random, though implementations may use optional sub-millisecond and counter fields to improve monotonicity. The RFC says implementations should use v7 instead of v1 or v6 if possible. This gives approximate chronological ordering, not a globally authoritative event or transaction sequence: clock changes and multiple generators can affect ordering.

For random IDs without time ordering: UUIDv4

Use v4 when random or pseudorandom identifiers meet the requirement and timestamp-based sorting is not needed. RFC 9562 describes 122 random bits after the version and variant bits are assigned. The generator should use a well-sourced random or pseudorandom source; randomness does not make a UUID a safe bearer token.

For repeatable IDs from a name: UUIDv5

Use v5 when a stable namespace and consistently canonicalized name should map to the same UUID. Changing the namespace or name-normalization rules changes the result, so define those inputs carefully. V3 is the older MD5-based alternative and is generally for compatibility. If policy calls for SHA-256 or a newer hash for name-derived IDs, RFC 9562 points to a documented v8 design rather than v5.

For a v1 system: UUIDv6

V6 rearranges v1’s timestamp fields to improve database locality while retaining a v1-compatible approach. RFC 9562 expects it mainly in contexts already using v1 and recommends v7 for systems without that legacy constraint.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

For a custom layout: UUIDv8

Before choosing v8, check whether a standard version already meets the requirement. A v8 design needs a documented algorithm and agreement between systems that generate or consume it; the format does not provide a general uniqueness guarantee.

Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

Account for privacy, security, and ordering

Timestamp and node information can be exposed

V7 includes a timestamp that reveals approximate creation time. V1 may include a MAC-based node identifier, which can expose network-address information; RFC 9562 warns about the privacy and network-security concerns. Python’s official UUID documentation likewise warns that uuid1() may compromise privacy because it contains the computer’s network address. V6’s reordered timestamp does not, by itself, remove legacy node-field concerns.

A UUID is an identifier, not an access credential

RFC 9562 says implementations must not assume UUIDs are hard to guess or use them as security capabilities. Use a separate authorization mechanism for access control and secrets; possession of a record’s UUID must not grant permission to access it.

Rank #4
Computer Programming For Teens
  • Used Book in Good Condition

Time ordering is approximate

V7’s timestamp helps IDs sort chronologically in compatible bytewise or lexical representations, but it does not establish causal order or database commit order. Generator behavior, clock rollback, serialization, and byte-order conventions matter when relying on sorting.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Check runtime support before adopting a version

Version availability depends on the language and library. The Python standard-library documentation reviewed lists generators for v1, v3, v4, and v5; it does not document a standard-library v7 generator. Check the documentation and behavior for your actual runtime or library before selecting v7.

  • Confirm the version is supported in the deployed runtime, not only in a development environment.
  • Review the randomness source and behavior under concurrent generation.
  • Check how the generator handles clock rollback and whether it offers monotonicity fields.
  • Verify serialization and byte-order conventions wherever IDs are sorted or exchanged.

Practical selection summary

  • Choose v7 for new time-ordered identifiers when your stack supports a sound implementation.
  • Choose v4 for random identifiers when timestamp ordering is unnecessary.
  • Choose v5 for deterministic namespace-and-name identifiers; retain v3 when compatibility requires it.
  • Choose v6 mainly for v1 migration or compatibility, and v8 only for a documented custom layout.
  • Do not use any UUID as a bearer secret or authorization capability.

Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.

Leave a Reply

Your email address will not be published. Required fields are marked *

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

More from the Wire

  1. World desk4 min
    How to Spot an AI Voice Scam Before Sending MoneyDon’t rely on how a caller sounds. Pause, call back through a known number, and verify the emergency with another trusted person before sending money.
  2. Mountain View desk4 min
    Google’s SynthID Detector: How to Check AI-Generated Images, Video and AudioGoogle’s SynthID Detector looks for an embedded watermark in supported images, video and audio. Here is what its results do—and do not—show.
  3. Redmond desk20 min
    How to create a link to File or Folder in Windows 11Windows 11 gives you several ways to point to a file or folder without moving or duplicating it. You can create a desktop shortcut,…
Recommended PC Tool
Recommended PC Tool
PC Slower Than It Used to Be?Free scan - under a minute
Crashes, No Sound, or Screen Glitches?Free driver scan

Two free Windows tools

One Free Minute Could Fix That PC

Before you go - each of these free tools takes about a minute and tackles what quietly slows a Windows PC down.

Special offer. View Outbyte info, uninstall instructions, EULA, and Privacy Policy.