Generate UUID-like Hex IDs
Database primary keys and distributed system identifiers need to be unique without coordination. Full UUIDs include version and variant bits that reduce the randomness. This example generates pure random hex strings with 128 bits of entropy, formatted using the familiar UUID display pattern (8-4-4-4-12). The three generated IDs show the format at a glance.
How to Use
- The charset is pre-set to Hex (lowercase)
- Length is 32 characters (128 bits)
- Group size is 8 with hyphen separator for the UUID display format
- Quantity is 3 to show multiple IDs
- Click Generate
Using Hex IDs in Production
Storage Format
Store hex IDs as UUID columns in PostgreSQL or as BINARY(16) in MySQL. Text storage using CHAR(32) or VARCHAR(36) wastes space and sorts incorrectly. Most databases support native UUID types that store the 16 bytes efficiently and index properly. If you need the string form for display, convert at query time with the database builtin functions.
Generating IDs Client Side
The main advantage of client-generated IDs is eliminating round trips. You can create a record with its ID already known, insert it, and render the result immediately without waiting for a database-generated sequence. This matters for offline-first applications, optimistic UI updates, and any system where latency or availability requires working without the database.
Testing with Hex IDs
When writing integration tests, deterministic hex IDs make test output easier to read and debug. Use this tool to generate a set of IDs for your test fixtures, hardcode them in the test data, and assert on specific ID values in your test assertions. The hex format is short enough to fit in a test file without wrapping, and the grouping makes it easy to tell IDs apart by visual scan.