What is a UUID?
UUID stands for Universally Unique Identifier. It is a 128-bit label used for information in computer systems.
What is a GUID?
GUID stands for Globally Unique Identifier. It is essentially the same as a UUID, a term used primarily by Microsoft.
How to generate a UUID in Python?
import uuid; print(uuid.uuid4())
How to generate a UUID in JavaScript?
crypto.randomUUID()
How to generate a UUID in Java?
java.util.UUID.randomUUID().toString()
What is a Version 4 UUID?
Version 4 UUIDs are randomly generated. They do not contain MAC addresses or timestamps, ensuring privacy.
Is a UUID guaranteed to be unique?
While not theoretically impossible, the probability of collision is so astronomically low that for all practical purposes, yes.
What is the length of a UUID?
A standard UUID is 36 characters long, including hyphens.
How many bits in a UUID?
A UUID is 128 bits long.
Can I use UUIDs as database keys?
Yes, UUIDs are excellent primary keys for distributed systems where collision avoidance is critical.
What is a Nil UUID?
A Nil UUID is a special UUID where all bits are set to zero: 00000000-0000-0000-0000-000000000000.
What is a Version 1 UUID?
Version 1 UUIDs are generated based on the current time and the MAC address of the computer generating it.
How to validate a UUID?
Match regex: ^[0-9a-f]{8}-[0-9a-f]{4}-[0-5][0-9a-f]{3}-[089ab][0-9a-f]{3}-[0-9a-f]{12}$
Can UUIDs contain uppercase letters?
Yes, UUIDs are hexadecimal and case-insensitive, though lowercase is the canonical form.
How to generate a UUID in C#?
Guid.NewGuid().ToString()
Probability of a collision?
You would need to generate 1 billion UUIDs per second for 85 years to have a 50% chance of a single collision.
Can I compress a UUID?
Yes, you can encode the 128 bits into Base64 (22 chars) or Base58 to save space.
What is a Version 3 UUID?
Version 3 UUIDs are generated using MD5 hashing of a namespace identifier and a name.
What is a Version 5 UUID?
Version 5 UUIDs are generated using SHA-1 hashing of a namespace and a name. They are preferred over v3.
Is UUID random?
Version 4 UUIDs are random. Other versions are deterministic.
How to generate a UUID in PHP?
Use uniqid() or a library like ramsey/uuid.
How to generate a UUID in SQL?
In MySQL: UUID(). In PostgreSQL: gen_random_uuid(). In SQL Server: NEWID().
Why use UUID instead of Integer ID?
UUIDs are unique across tables and databases, safer for URLs (unnumbered), and enable offline generation.
Does UUID affect database performance?
Yes, random UUIDs can cause fragmentation in clustered indexes. Sequential UUIDs (v7) help mitigate this.
What is UUID v7?
UUID v7 is a new time-ordered UUID format designed for better database index performance compared to v4.
How to convert UUID to binary?
Most languages provide methods to get the raw 16 bytes. In SQL, use UNHEX(REPLACE(uuid, '-', '')).
Is UUID secure?
UUIDs are unique but not secret. Do not use them as API keys or passwords.
Can I predict the next UUID?
For v4, no, if the random number generator is cryptographically secure. For v1, yes.
What is the structure of a UUID?
8-4-4-4-12 hexadecimal digits. Example: 123e4567-e89b-12d3-a456-426614174000.
How to generate UUID in Go?
uuid.New().String()
How to generate UUID in Ruby?
SecureRandom.uuid
How to generate UUID in Swift?
UUID().uuidString
How to generate UUID in Linux?
Run 'uuidgen'.
What is the Variant field?
It determines the layout of the UUID. The most common variant is RFC 4122.
Can I make a custom UUID?
You can create custom identifiers, but they won't technically be UUIDs unless they follow the RFC 4122 bit layout.
Are UUIDs sortable?
Standard v4 UUIDs are not sortable by time. v1 and v7 are time-ordered and sortable.
How to generate 100 UUIDs at once?
Use the Bulk Generator tool on N28.net.
Is GUID bigger than Int?
Yes. A GUID is 128 bits (16 bytes), while a standard Int is 32 bits (4 bytes).
What does the '4' in a v4 UUID mean?
The '4' in the third group (e.g., xxxxxxxx-xxxx-4xxx...) indicates the version number.
Can I use UUID for session ID?
Yes, v4 UUIDs make excellent, non-guessable session identifiers.