
Create random version 4 UUIDs for roles, tenants or test rows in a seed script, with a sample SQL insert and checks before you commit.
Your migration needs to insert five default roles, and the foreign keys elsewhere in the same file must point at the exact same identifiers. If you let the database generate them at insert time, the later statements cannot reference them. Pre-generating the values and pinning them in the script is the fix, and UUID Generator hands you a batch in one click.
Press Generate and the page produces random UUIDs using the browser's own cryptographic generator. Nothing is sent to a server to create them, and the list exists only on the page until you leave it.
Leave Count at 5 and press Generate. One run produced values like these:
Yours will differ, which is the point. Paste them into the seed so each role keeps its id forever: INSERT INTO roles (id, name) VALUES ('4bfdd325-…', 'owner'), ('7b673879-…', 'admin'), ('69273e3d-…', 'editor'), ('5dff6ea4-…', 'viewer'), ('5f08172c-…', 'billing');. A later statement that grants permissions can then reference the owner id literally, and every environment (local, staging, production) ends up with identical role ids.
Commit those values to version control as they are. Regenerating them on a later run would break every row that already references the old ones.
The tool creates version 4 UUIDs, which are built from random bits. A UUID is 36 characters long: 32 hexadecimal digits in groups of 8, 4, 4, 4 and 12. In a version 4 value the first digit of the third group is always 4, and the first digit of the fourth group is one of 8, 9, a or b. Check the sample list: the third groups are 4ca1, 4784, 4faf, 4b52 and 428a, all starting with 4, and the fourth groups start with a, a, b, a and a.
It does not offer version 1, name-based version 5 or the newer time-ordered versions, and it adds no braces. Hyphens can be switched off and Uppercase switched on. If a system wants braces, paste the list into Find and Replace or change case in your code.
A version 4 UUID carries 122 random bits. Even if you generated a billion identifiers, the chance of any pair matching is roughly 1 in 10 quintillion, far below the risk of a disk error. For normal projects you can treat them as unique across separate machines without coordination.
Keep a unique constraint on the column anyway. The constraint is cheap, it catches a copy-paste mistake such as the same id pasted twice, and it protects you from values that were not generated by this tool at all.
Before running the migration, check the pasted ids with a quick pattern in the Regex Tester. A pattern such as ^[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$ should match every line of your list. A line that fails usually has a stray space, a missing character or a character dropped when copying from a chat window.
Also scan for duplicates between your seed file and any test fixtures. Sorting the list and looking for neighbours that match takes seconds, and finding a repeat by hand is far cheaper than debugging a failed constraint on a deployment night.
Random UUIDs are not secrets. They are good identifiers, but they are not API keys, passwords or session tokens, and they should not be the only thing standing between a stranger and private data. For credentials, use a generator built for secrets.
They are also unordered. If your database indexes the primary key and you insert millions of rows, purely random keys scatter writes across the index, which some teams avoid with time-ordered identifiers. That is a design decision for your stack, and this tool does not generate those. Neighbouring developer utilities sit in the security tools category, part of the 300+ professional tools, premium applications and workflow products on the site.
Decide how many ids your seed needs, generate them once, commit them with the migration, and run the pattern check. Then try the batch in a throwaway database before production. Open UUID Generator when you are ready.
Would you like to see other UUID versions, uppercase output or a one-click SQL insert template? Tell us on the contact page.