Developer & Data

UUID generator: what UUID v4 is, when to use it, and common mistakes

Generate UUID v4 identifiers for databases, APIs, and correlation IDs. Learn what makes UUIDs unique, when they are a good fit, and what not to use them for.

Feb 22, 20263 min readBy Mateo Díaz
uuiddevelopersdatabases
TLDR
  • UUIDs are useful when records need unique IDs without asking one central database for the next number.
  • Version 4 UUIDs are random and common for app records, test data, and distributed systems.
  • Use UUIDs where uniqueness matters, but consider shorter IDs when humans need to read or type them.

Use it now

UUID Generator

Open tool
Glass card with UUID-style segmented blocks and highlighted version and variant sections on a dark gradient

If you need an ID that is easy to generate, unlikely to collide, and safe to create on the client, UUID v4 is a common choice.

Start here:

  • Open the UUID Generator.
  • Choose how many IDs you need.
  • Copy the result.

What a UUID is

UUID stands for Universally Unique Identifier.

A UUID is a 128-bit identifier usually written as 32 hex characters with hyphens:

xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx

UUID v4 is the "random" version. It is generated from random bytes with a couple of fixed bits.

When UUID v4 is a good fit

Use UUID v4 for:

  • database primary keys when you do not want a central ID generator
  • request or trace correlation IDs
  • filenames or object keys when uniqueness matters

UUID v4 is especially useful in distributed systems because you can generate IDs independently.

When UUID v4 is not a good fit

Avoid UUID v4 when:

  • you need sortable IDs by creation time (UUID v4 is random)
  • you need short, human-friendly IDs
  • you are using the ID as a secret

A UUID is an identifier, not a password.

If you need a secret token, use the Password Generator.

Quick start: generate a UUID v4

  1. Open the UUID Generator.
  2. Set Number of UUIDs.
  3. Copy.

Textavia uses cryptographically secure randomness in your browser.

Examples

Example 1 (beginner): generate one ID for a spreadsheet

If you need a unique row key:

  • generate 1 UUID
  • paste it into the row

Example 2 (professional): correlation ID for logs

If you want to trace a request across services:

  • generate a UUID
  • attach it to logs and headers

Example 3 (professional): client-side temporary IDs

When you create items offline and sync later:

  • create a UUID per item
  • keep it stable through sync

Common mistakes

Treating UUIDs as secrets

UUIDs are not designed to be unguessable secrets.

If an attacker can see one UUID, it does not automatically expose others, but you should not use UUIDs as API keys.

Assuming "unique" means "impossible to collide"

UUID v4 collisions are extremely unlikely, but not mathematically impossible.

In normal software, it is safe to treat UUID v4 as unique.

Using UUIDs when you need ordering

If you need IDs that sort by time, use a time-ordered scheme (or store a timestamp separately).

If you only do 3 things

  • Use UUID v4 for identifiers, not secrets.
  • Store timestamps separately if you need ordering.
  • Generate IDs with a cryptographically secure RNG.

Sources and further reading

  • RFC 4122: A Universally Unique IDentifier (UUID) URN Namespace

Privacy and security

Textavia's UUID generator runs locally in your browser. Your generated IDs are not uploaded to a server.

Written by

Mateo Díaz

Builds, tests, and documents Textavia's tools, drawing on degrees in computer science and mathematics and a habit of explaining things plainly.

View author profile

Related tools

Related guides