# How I generate UUIDs for test data and identifiers

A beginner-friendly guide to UUID v4 identifiers, randomness, uniqueness expectations, and when UUIDs are useful.

- Date: 2026-09-27
- URL: https://ilham.dev/posts/how-to-generate-uuids-for-test-data/
- Markdown: https://ilham.dev/posts/how-to-generate-uuids-for-test-data/index.md
- Tags: uuid, ids, testing, tools
- Reading time: 2 min


A UUID v4 is a random-looking identifier that is useful when many systems need to create IDs without asking a central server first.

The [UUID Generator](/tools/uuid-generator/) tool helps with the mechanical part, but I still check the result before using it somewhere real.

## The simple idea

A UUID v4 is a random-looking identifier that is useful when many systems need to create IDs without asking a central server first.

I use the tool to make the transformation visible: input on one side, output on the other, and a quick sanity check before I copy anything.

## Step 1: Choose how many UUIDs you need

Choose how many UUIDs you need.

## Step 2: Generate them with a cryptographic random source

Generate them with a cryptographic random source.

## Step 3: Use lowercase or uppercase consistently

Use lowercase or uppercase consistently.

## Step 4: Use UUIDs for test records, request IDs, and object IDs when appropriate

Use UUIDs for test records, request IDs, and object IDs when appropriate.

## Step 5: Do not treat UUIDs as secrets just because they are hard to guess

Do not treat UUIDs as secrets just because they are hard to guess.

## Step 6: Avoid using UUIDs when a shorter human-friendly code is required

Avoid using UUIDs when a shorter human-friendly code is required.

## Step 7: Store them in a database type that fits your system

Store them in a database type that fits your system.

## My checklist

Before I trust the result, I check:

- Choose how many UUIDs you need.
- Generate them with a cryptographic random source.
- Use lowercase or uppercase consistently.
- Use UUIDs for test records, request IDs, and object IDs when appropriate.
- Do not treat UUIDs as secrets just because they are hard to guess.
- Avoid using UUIDs when a shorter human-friendly code is required.
- Store them in a database type that fits your system.

Small utilities are useful because they remove repetitive work. They are safest when the output is still reviewed.
