DEV Community

Johin Johny
Johin Johny

Posted on • Originally published at toolbox-kit.com

How to Generate a UUID Online (And When You Should Use One)

What Is a UUID?
A UUID (Universally Unique Identifier) is a 128-bit label used to identify information in computer systems. It looks like this:


550e8400-e29b-41d4-a716-446655440000

Enter fullscreen mode Exit fullscreen mode

That is 32 hexadecimal digits displayed in five groups separated by hyphens, following the pattern 8-4-4-4-12. The total number of possible UUIDs is 2^128 — roughly 340 undecillion. The odds of generating two identical UUIDs are so low that you can treat them as unique without any coordination between systems.

UUID Versions: v1 vs v4
Not all UUIDs are created the same way.

UUID v1 (Time-Based)
Generated from the current timestamp and the MAC address of the machine. This means:

  • UUIDs are roughly sortable by creation time

  • Two UUIDs from the same machine will never collide

  • The MAC address is embedded, which can be a privacy concern

UUID v4 (Random)
Generated from random or pseudo-random numbers. This is the most commonly used version because:

  • No information about the machine or time is leaked

  • Simple to generate — just 122 random bits

  • Supported by every language and platform

When in doubt, use v4. It is the default in most libraries and the safest choice for general use.

When to Use UUIDs vs Auto-Increment IDs
Auto-increment IDs (1, 2, 3, ...) are simple and small. UUIDs are larger and random. Here is when each makes sense:

Use Auto-Increment IDs When:

  • You have a single database and never need to merge data

  • You need compact, human-readable IDs (like order #1042)

  • Storage efficiency matters (4 bytes vs 16 bytes per ID)

Use UUIDs When:
Distributed systems — multiple services or databases need to generate IDs independently without coordination
Security — you don't want users to guess valid IDs by incrementing (/users/1, /users/2)
Data merging — combining datasets from different sources without ID collisions
Offline-first apps — clients generate IDs before syncing to a server
Public APIs — UUIDs prevent enumeration attacks on your endpoints
Most modern applications use UUIDs for at least some of their identifiers, especially for resources exposed in URLs or APIs.

How to Generate UUIDs With ToolBox
Step 1: Open the UUID Generator
Go to ToolBox UUID Generator. The interface is straightforward — you will see generated UUIDs immediately.

Step 2: Generate UUIDs
Click to generate one or multiple UUIDs at once. Each UUID is a cryptographically random v4 identifier generated entirely in your browser using the Web Crypto API.

Step 3: Copy and Use
Click any UUID to copy it to your clipboard, or copy all of them at once. Use them in your database schemas, API payloads, configuration files, or anywhere you need unique identifiers.

UUIDs in Different Languages
Here is how you generate UUIDs programmatically in common languages:

JavaScript / Node.js


// Node.js (built-in since v14.17)

const { randomUUID } = require('crypto');

console.log(randomUUID());

// Browser

console.log(crypto.randomUUID());

Enter fullscreen mode Exit fullscreen mode

Python


import uuid

print(uuid.uuid4())

Enter fullscreen mode Exit fullscreen mode

Go


import "github.com/google/uuid"

id := uuid.New()

Enter fullscreen mode Exit fullscreen mode

PostgreSQL


SELECT gen_random_uuid();

Enter fullscreen mode Exit fullscreen mode

Common UUID Mistakes
Storing as VARCHAR Instead of a UUID Type
If your database supports a native UUID type (PostgreSQL, MySQL 8+), use it. Storing UUIDs as VARCHAR(36) wastes space and is slower to index.

Using UUIDs as Primary Keys in MySQL with InnoDB
InnoDB stores rows in primary key order. Random UUIDs cause frequent page splits and poor write performance. If you must use UUIDs as primary keys in MySQL, consider UUID v7 (time-ordered) or store them as BINARY(16) with ordered generation.

Assuming UUIDs Are Secret
UUIDs are unique, not secret. Do not use a UUID as an authentication token or password reset link unless combined with other security measures. They are identifiers, not credentials.

Try It Free
Open ToolBox UUID Generator — generate cryptographically random UUIDs instantly in your browser. Free, private, no signup required.

Need to hash those UUIDs? Try the Hash Generator. Building an API that uses UUIDs? Generate mock responses with the API Mock Response Generator.

Top comments (0)