UUID Generator
Generate RFC 4122 compliant v1 (time-based) and v4 (random) UUIDs for database primary keys and unique identifiers
About UUIDs
UUIDs (Universally Unique Identifiers) are 128-bit identifiers standardized by RFC 4122 that are designed to be unique across all devices globally without requiring a central registration authority.
Common UUID versions and their characteristics:
- UUID v1: Time-based version that includes the MAC address of the computer that generated it. This provides uniqueness but can expose information about the generating system.
- UUID v4: Random version that uses random or pseudo-random numbers. This is the most commonly used version for most applications.
This tool generates UUIDs client-side using JavaScript. For production applications, consider using RFC 4122 compliant libraries specific to your backend or frontend framework.
UUID Format Examples
UUIDs follow a standardized format defined in RFC 4122. They consist of 32 hexadecimal digits displayed in 5 groups separated by hyphens, in the form 8-4-4-4-12 for a total of 36 characters (including hyphens).
UUID Version | Example | Use Case |
---|---|---|
Version 4 (Random) | 123e4567-e89b-12d3-a456-426614174000 | Database primary keys, Any application requiring unique IDs |
Version 1 (Time-based) | 4afs35c9-45fd-11ec-81d3-0242ac130003 | Logging, Time-sequenced events |
UUID in Different Programming Languages
Here are examples of how to generate UUIDs in common programming languages:
JavaScript/Node.js:
import { v4 as uuidv4 } from 'uuid';
const id = uuidv4(); // ⇨ '9b1deb4d-3b7d-4bad-9bdd-2b0d7b3dcb6d'
Python:
import uuid
id = uuid.uuid4() # ⇨ UUID('9b1deb4d-3b7d-4bad-9bdd-2b0d7b3dcb6d')
Java:
import java.util.UUID;
UUID uuid = UUID.randomUUID(); // ⇨ 9b1deb4d-3b7d-4bad-9bdd-2b0d7b3dcb6d