Identifier guide

UUID v1, v4, and v7: Which Version Should You Use?

Compare UUID versions and choose an identifier format that fits application, database, and ordering requirements.

UUID versions are not interchangeable. The right choice depends on whether you need random identifiers, time ordering, compatibility with an existing system, or a stable namespace-based value.

UUID v4 for general random IDs

UUID v4 is random and widely supported. It is a practical default when you need a unique identifier but do not want the identifier to expose ordering information.

UUID v7 for sortable identifiers

UUID v7 includes a timestamp component and is designed to sort by creation time while retaining a large random component. It can be useful for database keys and event identifiers when chronological locality matters.

Use v1 and namespace versions intentionally

UUID v1 contains time and node-related information, so consider its information exposure before using it. Namespace-based versions are useful when the same input must consistently produce the same identifier.

Continue with related checks and tools