UUID, ULID & Nano ID Generator

Generate identifiers in bulk: UUID v4 and v7, ULID, Nano ID or a MongoDB ObjectId. Each kind says whether it sorts by creation time, which is usually the reason to pick one over another.

Kind

Same thing, as an API

curl 'https://akifakkaya.com/api/v1/tools/ids?kind=uuid4&count=10&uppercase=false&hyphens=true'

Free, no key, 120 requests a minute. Full endpoint reference

Identifiers

Pick a kind to generate identifiers.

Which one to pick

  • Primary key: UUID v7 or ULID. Both start with a millisecond timestamp, so rows insert in order and the index stays dense.
  • Public URL: Nano ID. 21 URL-safe characters, nothing to percent-encode.
  • Must reveal nothing: UUID v4. No timestamp, no host, no ordering.
  • Avoid: UUID v1 in anything public — it embeds the generating machine's MAC address.

About this tool

UUID v4 is 122 random bits and the right default when an id should say nothing about when or where it was made. The cost shows up at scale: random ids arrive in random order, so every insert lands in a random leaf of the primary key's B-tree, and the index stops fitting the pattern the database is optimised for.

UUID v7 and ULID are the same answer to that problem from two directions. Both put a 48-bit millisecond timestamp first and randomness after it, so ids sort by creation time and inserts append instead of scattering. v7 is an RFC 9562 UUID and drops into any uuid column; a ULID is 26 Crockford base32 characters — shorter, case-insensitive, and with no I, L, O or U to be misread aloud.

Nano ID is the one to reach for in a URL: 21 characters from a URL-safe alphabet, comparable collision odds to a UUID, and nothing to percent-encode. ObjectId is here because MongoDB hands them out, and because its layout — four bytes of seconds, five random, three of counter — explains both why they sort and why they leak an approximate creation time.

Questions

Should I use UUID v4 or v7 for a primary key?
v7, in most cases. It keeps the uniqueness properties of v4 while inserting sequentially, which keeps index pages dense and write amplification low. Use v4 when an id must not reveal when the row was created.
Are these generated securely?
The random bits come from the operating system's CSPRNG — Python's `secrets` module. That said, an identifier is not a secret: if something must be unguessable, use a token, not an id.
UUID v7 or ULID?
Functionally equivalent. Pick v7 if the value lives in a native UUID column or crosses a boundary that expects UUID formatting; pick ULID if it will be read, typed or spoken by people, since base32 is shorter and drops lookalike characters.
Can I generate a lot at once?
Up to 500 per request, and the list can be copied or downloaded as a text file. For more than that, call the endpoint in a loop — it is the same free API this page uses.
Use it as an APIEvery tool here is a public endpoint. Free, no key, 120 requests a minute.Mock data generatorBuild a schema and export rows as JSON, CSV, SQL or NDJSON.

Other tools