[{"data":1,"prerenderedAt":99},["ShallowReactive",2],{"tool-guide:identifier-generator":3},{"overview":4,"whatIs":5,"useCases":6,"steps":12,"commonMistakes":17,"relatedStandards":23,"comparison":33,"example":76,"limitations":80,"faq":83},"UUID \u002F ULID Generator creates bounded batches with browser cryptographic randomness, including random UUID v4 and time-ordered UUID v7 or ULID values.","Universally Unique Identifiers (UUIDs) and Universally Unique Lexicographically Sortable Identifiers (ULIDs) are standardized formats for generating unique IDs without a central authority. UUID v4 uses 122 random bits to produce identifiers like 550e8400-e29b-41d4-a716-446655440000 — the collision probability is so low that generating one billion UUIDs per second for 85 years would yield a 50% chance of a single duplicate. UUID v7 (RFC 9562, 2024) embeds a millisecond Unix timestamp in the first 48 bits followed by random bits, producing IDs that sort chronologically. This dramatically improves database index performance because new rows are appended to the B-tree instead of being inserted at random positions. ULIDs achieve the same time-ordering using Crockford Base32 encoding (26 characters instead of 36), which is shorter, URL-safe, and case-insensitive. Choosing the right identifier format depends on your use case: v4 for maximum randomness when ordering does not matter, v7 for time-sorted database primary keys, and ULID when you need shorter, sortable, human-friendly IDs.",[7,8,9,10,11],"Database primary keys — generate UUID v7 or ULID values for new rows so the index stays ordered by creation time without an auto-incrementing counter.","Distributed systems — create globally unique identifiers across microservices without coordination, avoiding the single point of failure of a sequence generator.","Correlation IDs — tag each request with a UUID v4 so you can trace it across logs, queues, and downstream services.","Idempotency keys — attach a UUID to API requests so the server can deduplicate retries without processing the same operation twice.","File and object naming — generate unique filenames for S3 uploads, temporary files, or cache entries without worrying about collisions.",[13,14,15,16],"Choose the identifier format: UUID v4 (fully random), UUID v7 (time-ordered), or ULID (time-ordered, shorter).","Set a batch size — generate one ID or up to hundreds at once.","Generate fresh values. Each batch is independent and uses crypto.getRandomValues().","Copy or download the identifiers. UUID v7 and ULID values sort chronologically by their embedded timestamp.",[18,19,20,21,22],"Using UUIDs as security tokens — UUIDs are identifiers, not secrets. UUID v4 is random but only 122 bits; for authentication tokens, use a dedicated token generator with at least 256 bits.","Storing UUIDs as strings in the database — a UUID stored as CHAR(36) uses 36 bytes plus overhead. Use the native UUID column type (16 bytes) or BINARY(16) for better storage and index performance.","Assuming UUID v4 values are sortable — UUID v4 is random and does not sort by creation time. Use UUID v7 or ULID if you need chronological ordering.","Comparing UUIDs case-sensitively — UUIDs are hexadecimal and case-insensitive. \"550E8400...\" and \"550e8400...\" are the same UUID.","Exposing sequential IDs — auto-incrementing integers reveal how many records exist and are easily enumerable. UUIDs prevent this information leakage.",[24,27,30],{"title":25,"url":26},"RFC 9562 — Universally Unique IDentifiers (UUIDs)","https:\u002F\u002Fdatatracker.ietf.org\u002Fdoc\u002Fhtml\u002Frfc9562",{"title":28,"url":29},"ULID Specification","https:\u002F\u002Fgithub.com\u002Fulid\u002Fspec",{"title":31,"url":32},"RFC 4122 — UUID (original, superseded by RFC 9562)","https:\u002F\u002Fdatatracker.ietf.org\u002Fdoc\u002Fhtml\u002Frfc4122",{"heading":34,"columns":35,"rows":39},"UUID v4 vs UUID v7 vs ULID",[36,37,38],"UUID v4","UUID v7","ULID",[40,45,50,55,61,66,71],{"label":41,"values":42},"Time-ordered",[43,44,44],"No","Yes (ms timestamp)",{"label":46,"values":47},"Format",[48,48,49],"8-4-4-4-12 hex","26 Crockford Base32",{"label":51,"values":52},"Length",[53,53,54],"36 chars","26 chars",{"label":56,"values":57},"Random bits",[58,59,60],"122","62","80",{"label":62,"values":63},"DB index friendly",[64,65,65],"Poor (random insert)","Excellent (append-only)",{"label":67,"values":68},"Case-sensitive",[69,69,70],"No (hex)","No (Crockford Base32)",{"label":72,"values":73},"Standard",[74,74,75],"RFC 9562","Community spec",{"label":77,"input":78,"output":79},"Generate a UUID v7","Type: UUID v7\nCount: 1","0191f2a5-7b3c-7def-8a12-6f49476b6579",[81,82],"Example output is synthetic; generated values are fresh on every run.","Time ordering does not make an identifier secret or unpredictable as an access token.",[84,87,90,93,96],{"question":85,"answer":86},"What is the difference between UUID v4 and UUID v7?","UUID v4 is fully random. UUID v7 embeds a millisecond timestamp in the first 48 bits so identifiers sort chronologically, which improves database index performance.",{"question":88,"answer":89},"What is a ULID?","A ULID is a 128-bit identifier with a 48-bit timestamp prefix and 80 random bits, encoded in Crockford Base32. Like UUID v7, it sorts by creation time.",{"question":91,"answer":92},"Are these identifiers cryptographically secure?","The random bits come from the browser's crypto.getRandomValues(), which is cryptographically secure. However, UUIDs and ULIDs are identifiers, not secrets — do not use them as access tokens.",{"question":94,"answer":95},"Which format should I use for database primary keys?","UUID v7 is the best choice for most databases. It sorts chronologically (efficient B-tree inserts), uses the standard UUID format (native database support), and is globally unique.",{"question":97,"answer":98},"How likely is a UUID collision?","With 122 random bits (UUID v4), generating 1 billion UUIDs per second for 85 years gives a 50% chance of one collision. In practice, collisions are not a concern.",1788868141011]