<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: DevToolEra </title>
    <description>The latest articles on DEV Community by DevToolEra  (@devtoolera).</description>
    <link>https://dev.to/devtoolera</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F4255463%2Fedfb4eb7-9304-4111-9e4a-5168fccce864.jpg</url>
      <title>DEV Community: DevToolEra </title>
      <link>https://dev.to/devtoolera</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/devtoolera"/>
    <language>en</language>
    <item>
      <title>UUID Generator Explained: Generate, Validate and Choose the Right ID, Step by Step</title>
      <dc:creator>DevToolEra </dc:creator>
      <pubDate>Fri, 20 Nov 2026 21:06:01 +0000</pubDate>
      <link>https://dev.to/devtoolera/uuid-generator-explained-generate-validate-and-choose-the-right-id-step-by-step-eh3</link>
      <guid>https://dev.to/devtoolera/uuid-generator-explained-generate-validate-and-choose-the-right-id-step-by-step-eh3</guid>
      <description>&lt;p&gt;If you just need a unique ID right now, open the &lt;a href="https://devtoolera.com/tools/uuid-generator/" rel="noopener noreferrer"&gt;UUID Generator&lt;/a&gt;, choose a version, press &lt;strong&gt;Generate&lt;/strong&gt;, and copy the result. Nothing is installed and nothing is uploaded: the values are created on your device with &lt;code&gt;crypto.getRandomValues&lt;/code&gt;, the same random source browsers use for cryptography.&lt;/p&gt;

&lt;p&gt;This post goes through the rest: what each control does, how to make the less common identifiers (UUID v1, v3, v5, v6, ULID, NanoID and KSUID), how to validate a list of IDs, and how to decide which type to use. You can follow each step on the tool page as you read.&lt;/p&gt;

&lt;h2&gt;
  
  
  What a UUID is, in one minute
&lt;/h2&gt;

&lt;p&gt;A UUID (universally unique identifier) is a 128-bit value written as 32 hexadecimal digits in five groups:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;550e8400-e29b-41d4-a716-446655440000
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Applications use UUIDs as database keys, request IDs and file names without needing a central authority to hand out numbers. What changes between versions is how the value is built, and that decides how it sorts and what it reveals.&lt;/p&gt;

&lt;h2&gt;
  
  
  Step 1: Generate a UUID v4, v7 or Nil UUID
&lt;/h2&gt;

&lt;p&gt;Open the &lt;a href="https://devtoolera.com/tools/uuid-generator/" rel="noopener noreferrer"&gt;UUID Generator&lt;/a&gt;. The first panel has everything for the standard versions.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Pick a version.&lt;/strong&gt; The selector offers three choices:

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;v4 (random):&lt;/strong&gt; almost entirely random, with 122 random bits. It is the most widely supported choice.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;v7 (time-ordered):&lt;/strong&gt; starts with a millisecond timestamp, followed by random bits. New values sort roughly by creation time, which keeps database indexes efficient.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Nil UUID:&lt;/strong&gt; all zeros, sometimes used as an "empty" placeholder.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Set the quantity.&lt;/strong&gt; You can create up to 1000 UUIDs at once.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Choose the format.&lt;/strong&gt; Tick &lt;strong&gt;Uppercase&lt;/strong&gt; for capital letters, or &lt;strong&gt;No hyphens&lt;/strong&gt; to get 32 plain hexadecimal digits.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Press Generate.&lt;/strong&gt; The results appear in the UUIDs list. The tool also makes a first batch when the page opens and refreshes the list whenever you change the version, Uppercase or No hyphens, so you can simply watch it update.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Take the result with you.&lt;/strong&gt; &lt;strong&gt;Copy all&lt;/strong&gt; puts every value on the clipboard, &lt;strong&gt;Download&lt;/strong&gt; saves them, and &lt;strong&gt;Clear&lt;/strong&gt; starts again.&lt;/li&gt;
&lt;/ol&gt;

&lt;h3&gt;
  
  
  Reading a v7 batch
&lt;/h3&gt;

&lt;p&gt;When you generate several v7 values together, they start with the same timestamp prefix and increase one by one, for example &lt;code&gt;…aa81…&lt;/code&gt;, &lt;code&gt;…aa82…&lt;/code&gt;, &lt;code&gt;…aa83…&lt;/code&gt;. The first 48 bits are the Unix time in milliseconds, the &lt;code&gt;7&lt;/code&gt; after the second hyphen group shows the version, and the rest is random. Values from one batch in this tool are strictly increasing, so they cannot repeat.&lt;/p&gt;

&lt;p&gt;To turn that timestamp into a readable date, use the &lt;a href="https://devtoolera.com/tools/timestamp-converter/" rel="noopener noreferrer"&gt;Timestamp Converter&lt;/a&gt;. The guide &lt;a href="https://devtoolera.com/guides/unix-timestamp-seconds-vs-milliseconds/" rel="noopener noreferrer"&gt;Unix timestamps in seconds vs milliseconds&lt;/a&gt; explains the units.&lt;/p&gt;

&lt;h3&gt;
  
  
  A quick v4 vs v7 test
&lt;/h3&gt;

&lt;ol&gt;
&lt;li&gt;Set the version to &lt;strong&gt;v7&lt;/strong&gt;, quantity to &lt;strong&gt;5&lt;/strong&gt;, and press &lt;strong&gt;Generate&lt;/strong&gt;. Look at the first characters: they barely change from line to line.&lt;/li&gt;
&lt;li&gt;Switch to &lt;strong&gt;v4&lt;/strong&gt;. The list refreshes by itself and the values look unrelated to each other.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;That difference is why v7 is friendlier to database indexes, and why v4 is a better fit when the creation time should stay private.&lt;/p&gt;

&lt;h2&gt;
  
  
  Step 2: Create the other identifier types
&lt;/h2&gt;

&lt;p&gt;Below the first panel, the &lt;strong&gt;More identifier types&lt;/strong&gt; section handles everything that is not plain random. It has its own &lt;strong&gt;Type&lt;/strong&gt; selector, quantity, &lt;strong&gt;Uppercase&lt;/strong&gt; and &lt;strong&gt;No hyphens&lt;/strong&gt; options, and the same &lt;strong&gt;Generate&lt;/strong&gt;, &lt;strong&gt;Copy all&lt;/strong&gt;, &lt;strong&gt;Download&lt;/strong&gt; and &lt;strong&gt;Clear&lt;/strong&gt; buttons, with results in an Identifiers list. The type selector offers UUID v1, v3, v5, v6, ULID, NanoID and KSUID.&lt;/p&gt;

&lt;h3&gt;
  
  
  UUID v1 and v6 (clock-based)
&lt;/h3&gt;

&lt;p&gt;Both hold a 100-nanosecond clock. Choose &lt;strong&gt;UUID v1 (time-based)&lt;/strong&gt; or &lt;strong&gt;UUID v6 (reordered time)&lt;/strong&gt;, set a quantity and press &lt;strong&gt;Generate&lt;/strong&gt;. The tool uses a random node value with the multicast bit set, so the value can never be a real network card address. UUIDs in one batch are strictly increasing.&lt;/p&gt;

&lt;h3&gt;
  
  
  UUID v3 and v5 (name-based)
&lt;/h3&gt;

&lt;p&gt;These two give the same UUID every time for the same input, which makes them useful for stable IDs, such as turning a URL or an email address into a consistent identifier.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Choose &lt;strong&gt;UUID v5 (name, SHA-1)&lt;/strong&gt;, or &lt;strong&gt;UUID v3 (name, MD5)&lt;/strong&gt;.&lt;/li&gt;
&lt;li&gt;Pick a &lt;strong&gt;Namespace&lt;/strong&gt;: DNS, URL, OID, X.500, or &lt;strong&gt;Custom UUID&lt;/strong&gt;. If you choose the custom option, enter your own namespace UUID.&lt;/li&gt;
&lt;li&gt;Type the &lt;strong&gt;names&lt;/strong&gt;, one per line.&lt;/li&gt;
&lt;li&gt;Press &lt;strong&gt;Generate&lt;/strong&gt;. You get one UUID per name.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;You can verify the result against another tool. UUID v5 of the name &lt;code&gt;example.com&lt;/code&gt; in the DNS namespace is always &lt;code&gt;cfbff0d1-9375-5685-968c-48ce8b15ae17&lt;/code&gt;, and the v3 version is always &lt;code&gt;9073926b-929f-31c2-abc9-fad77ae3e8eb&lt;/code&gt;. These values match the ones produced by Python's &lt;code&gt;uuid&lt;/code&gt; module.&lt;/p&gt;

&lt;p&gt;Two things to remember: the hashes are used for identity here, not for security, and a v3 or v5 UUID does not reveal the name it came from. To see how MD5 and SHA-1 compare with newer hashes, read &lt;a href="https://devtoolera.com/guides/md5-vs-sha256-vs-sha3-vs-blake2/" rel="noopener noreferrer"&gt;MD5 vs SHA-256 vs SHA-3 vs BLAKE2&lt;/a&gt;.&lt;/p&gt;

&lt;h3&gt;
  
  
  ULID
&lt;/h3&gt;

&lt;p&gt;A ULID is 26 characters: a millisecond time followed by random bits. Choose &lt;strong&gt;ULID&lt;/strong&gt;, set the quantity and generate. IDs in one batch sort ascending, even inside the same millisecond.&lt;/p&gt;

&lt;h3&gt;
  
  
  NanoID
&lt;/h3&gt;

&lt;p&gt;Choose &lt;strong&gt;NanoID&lt;/strong&gt; to make short random IDs from an alphabet you control.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Type your &lt;strong&gt;Alphabet&lt;/strong&gt;, the characters that are allowed.&lt;/li&gt;
&lt;li&gt;Set the &lt;strong&gt;Length&lt;/strong&gt;.&lt;/li&gt;
&lt;li&gt;Press &lt;strong&gt;Generate&lt;/strong&gt;.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;The tool uses rejection sampling, so every character of your alphabet is equally likely. The alphabet must not repeat a character, so &lt;code&gt;abc123&lt;/code&gt; works and &lt;code&gt;aabc&lt;/code&gt; does not.&lt;/p&gt;

&lt;h3&gt;
  
  
  KSUID
&lt;/h3&gt;

&lt;p&gt;A KSUID is 27 characters: a 4-byte time in seconds, counted from 13 May 2014 (UTC), followed by 16 random bytes. Choose &lt;strong&gt;KSUID&lt;/strong&gt; and generate as usual.&lt;/p&gt;

&lt;h2&gt;
  
  
  Step 3: Validate UUIDs
&lt;/h2&gt;

&lt;p&gt;The last panel, &lt;strong&gt;Validate a UUID&lt;/strong&gt;, checks IDs you already have, for example from a log, a database export or a bug report.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Paste your values, &lt;strong&gt;one per line&lt;/strong&gt;. Up to 200 lines can be checked at once. The results update as you paste, so there is no button to press.&lt;/li&gt;
&lt;li&gt;Not sure what to paste? Press &lt;strong&gt;Example&lt;/strong&gt; to load five sample lines (one of them deliberately invalid), and &lt;strong&gt;Clear&lt;/strong&gt; to empty the box.&lt;/li&gt;
&lt;li&gt;Read the results table. For each line it shows the &lt;strong&gt;Input&lt;/strong&gt;, whether it is &lt;strong&gt;Valid&lt;/strong&gt;, the &lt;strong&gt;Version&lt;/strong&gt;, the &lt;strong&gt;Variant&lt;/strong&gt;, the &lt;strong&gt;Time (UTC)&lt;/strong&gt; when the ID carries one, and &lt;strong&gt;Notes&lt;/strong&gt;.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;A status line tells you how many were valid; with the Example lines it says 4 of 5. The validator is forgiving about format. It accepts the usual 8-4-4-4-12 form, 32 digits without hyphens, &lt;code&gt;{braces}&lt;/code&gt; and the &lt;code&gt;urn:uuid:&lt;/code&gt; prefix, in upper or lower case. If you paste a ULID or a KSUID by mistake, it is recognised and its time is shown, so you can tell what kind of ID you are holding.&lt;/p&gt;

&lt;p&gt;Three honest limits: the check is about &lt;strong&gt;structure only&lt;/strong&gt;, so it cannot tell you whether a UUID is already in use; a v3 or v5 UUID cannot reveal the name it was made from; and a v1 UUID that contains a real hardware address in its node field can identify the machine that made it.&lt;/p&gt;

&lt;h2&gt;
  
  
  Step 4: Choose the right type
&lt;/h2&gt;

&lt;p&gt;A short rule of thumb based on how each type behaves in the tool:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;A new database table with many inserts:&lt;/strong&gt; UUID v7. New values land close together, which keeps indexes efficient.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;An ID shown publicly, where creation time should stay private:&lt;/strong&gt; UUID v4. A v7 UUID reveals when it was created, to the millisecond.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;The same input must always give the same ID:&lt;/strong&gt; UUID v5 (or v3, but prefer v5).&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Shorter, URL-friendly IDs that sort by time:&lt;/strong&gt; ULID or KSUID.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Short random IDs with your own alphabet:&lt;/strong&gt; NanoID.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Passwords, API keys, session or reset tokens:&lt;/strong&gt; none of them. A UUID is an identifier, not a secret.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The full reasoning, with database index effects, a comparison table and the RFC 9562 background, is in the companion guide: &lt;a href="https://devtoolera.com/guides/uuid-v4-vs-v7-vs-ulid/" rel="noopener noreferrer"&gt;UUID v4 vs v7 vs ULID vs KSUID: Which ID to Use&lt;/a&gt;. For secrets, use the &lt;a href="https://devtoolera.com/tools/password-generator/" rel="noopener noreferrer"&gt;Password Generator&lt;/a&gt; and read &lt;a href="https://devtoolera.com/guides/strong-random-password-length-entropy/" rel="noopener noreferrer"&gt;Strong Random Passwords: Length, Entropy and Real Numbers&lt;/a&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  Five everyday recipes
&lt;/h2&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;A pack of test IDs for a database seed.&lt;/strong&gt; Choose v4 or v7, set the quantity, press Generate, then &lt;strong&gt;Download&lt;/strong&gt; or &lt;strong&gt;Copy all&lt;/strong&gt;. Use v7 if you want the rows to sort in the order you created them.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;IDs without hyphens.&lt;/strong&gt; Tick &lt;strong&gt;No hyphens&lt;/strong&gt; for 32 plain hexadecimal digits, and &lt;strong&gt;Uppercase&lt;/strong&gt; if your system expects capitals.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;A stable ID for a known name.&lt;/strong&gt; In More identifier types, choose UUID v5, pick the DNS or URL namespace, type each name on its own line and generate. Run it again tomorrow and you get the same IDs.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Checking a pasted list.&lt;/strong&gt; Paste the values into Validate a UUID. Valid, Version and Variant tell you at a glance which lines are broken or from a different version than expected.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Finding out when an ID was made.&lt;/strong&gt; Paste a v7 UUID, a ULID or a KSUID into the validator. Where the ID carries a timestamp, the &lt;strong&gt;Time (UTC)&lt;/strong&gt; column shows it.&lt;/li&gt;
&lt;/ol&gt;

&lt;h2&gt;
  
  
  Good to know before you ship
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Collisions.&lt;/strong&gt; With 122 random bits in v4, the chance of two UUIDs matching is so small that it is ignored in practice. v7 has fewer random bits per millisecond, but values from one batch here are strictly increasing, so they cannot repeat.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;A UUID is not a secret.&lt;/strong&gt; Anyone who sees it can use it, and the version rules fix some of its bits.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Limits.&lt;/strong&gt; Up to 1000 identifiers per generation and 200 lines per validation. CUID2 is not offered.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Privacy.&lt;/strong&gt; The tool runs entirely in your browser. What you type is processed on your device and is not sent to a server.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Frequently asked questions
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;Which version should I use as a database key?&lt;/strong&gt; v7 is a good choice because new values are close together and keep indexes efficient. v4 is the most widely supported.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Can I use a UUID as a password?&lt;/strong&gt; No. Use a proper random token for secrets.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Are my UUIDs sent anywhere?&lt;/strong&gt; No. They are created in your browser.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Why does a v7 batch look so similar from line to line?&lt;/strong&gt; Every value starts with the same millisecond timestamp and then increases one by one.&lt;/p&gt;

&lt;h2&gt;
  
  
  Where to go next
&lt;/h2&gt;

&lt;p&gt;To practise, generate a batch of v7 values and a batch of v4 values, paste both into the validator, and compare the Version and Time (UTC) columns. For the reasoning behind each choice, read the guide &lt;a href="https://devtoolera.com/guides/uuid-v4-vs-v7-vs-ulid/" rel="noopener noreferrer"&gt;UUID v4 vs v7 vs ULID vs KSUID: Which ID to Use&lt;/a&gt;. More browser-based developer utilities are listed on the &lt;a href="https://devtoolera.com/" rel="noopener noreferrer"&gt;DevToolEra home page&lt;/a&gt;.&lt;/p&gt;

</description>
      <category>webdev</category>
      <category>tutorial</category>
      <category>database</category>
      <category>programming</category>
    </item>
  </channel>
</rss>
