What UUIDs are, why v4 is the safest version, and how to generate them in JavaScript, Python, PHP, Java, Go and Rust.
What a UUID is
A Universally Unique Identifier is a 128-bit number written as 32 hex digits in 5 groups. Version 4 UUIDs are randomly generated.
Which version to use
For 99% of cases, UUID v4. Use v5 if you need deterministic IDs from a namespace. Never v1 if you do not want to leak MAC or timestamp.
Generating in code
One line in most languages.
- JavaScript: crypto.randomUUID()
- Python: import uuid; uuid.uuid4()
- PHP: random_bytes(16)
- Java: UUID.randomUUID()
- Go: github.com/google/uuid
- Rust: uuid::Uuid::new_v4()
Generate without code
Use our free UUID Generator to produce up to 100 v4 UUIDs at once.