When to use UUID v4
A practical guide to when UUID v4 fits well, when it does not, and how collisions, readability, databases and testing affect the choice.
Use UUID v4 when uniqueness matters more than meaning
UUID v4 is a good fit when you need an ID that is easy to generate and very unlikely to collide across systems, services or test runs.
It works well for database primary keys, temporary records, public references and generated test data when the exact value does not need to be readable.
Avoid it when human-friendly IDs or ordered values matter
UUID v4 is not ideal when users must read, type or remember the ID, because the string is long and not descriptive.
For logs, exports and debugging, a shorter label or a structured ID can be easier to scan, while UUID v4 is better kept as the hidden technical identifier.