Skip to content
Developer & Security

MongoDB ObjectId Generator

Create valid MongoDB ObjectIds for seed data, fixtures and API tests — 24-character hexadecimal IDs built from a timestamp, a random value and an incrementing counter, up to 200 at a time.

  • 100% free
  • Runs in your browser
  • No sign-up
  • CSV · JSON · TXT export
Options

Tip: press Enter or Space to generate again.

Ready

What is the MongoDB ObjectId Generator?

Every document in MongoDB has an _id field, and by default it holds an ObjectId: a 12-byte value written as 24 hexadecimal characters. Its structure is well defined. The first 4 bytes are a timestamp in seconds since the Unix epoch, the next 5 bytes are a random value, and the final 3 bytes are a counter that increases with each new ID.

This generator follows that layout, so the IDs it produces are valid ObjectIds that MongoDB drivers and tools will accept. You can see the structure in the output: IDs generated together share the same timestamp prefix, and consecutive IDs often differ only in the last characters as the counter increments. Create up to 200 at once and paste them into seed scripts, JSON fixtures or test requests.

Because the timestamp is embedded, an ObjectId also tells you roughly when it was created, and IDs created later generally sort after earlier ones. Everything is generated in your browser — nothing is sent to a database or stored.

How to use the MongoDB ObjectId Generator

  1. Enter How many? ObjectIds you need, up to 200.
  2. Press Generate to create the IDs with the current timestamp.
  3. Copy a single ObjectId or the full list.
  4. Export the IDs as CSV, JSON or TXT for your seed data or tests.

Popular uses

  • Backend developers — prepare _id values for seed scripts and migrations.
  • QA testers — test endpoints that expect a valid ObjectId in the URL or body.
  • Data engineers — create consistent IDs to link documents across collections.
  • Educators — explain how ObjectIds encode time and order.

Why use RandNow?

  • Instant & unlimited — no sign-up, no daily caps.
  • Private by design — results are generated in your browser, not on our servers.
  • Export-ready — copy, CSV, JSON and TXT downloads built in.
  • Cryptographically random — powered by the Web Crypto API.

How to read an ObjectId

Take 6ada374cf3a161ca9725b8ea. The first 8 hex characters (6ada374c) are the timestamp, the next 10 are the random value and the last 6 are the counter. Converting the first 8 characters from hex to decimal gives the creation time in Unix seconds, which most MongoDB drivers expose with a helper such as getTimestamp().

Testing tips

Use generated IDs to test “not found” responses, invalid-ID handling and references between documents. Avoid treating ObjectIds as secret: they are predictable by design. Press Generate again for a fresh set — it’s free and unlimited.

Frequently asked questions

Are these valid MongoDB ObjectIds?

Yes. They are 24-character hex strings following the ObjectId structure of timestamp, random value and counter, so MongoDB tools accept them.

Why are the IDs so similar to each other?

IDs created at the same moment share the timestamp and random value, and the counter at the end increments, so consecutive IDs differ only in the last few characters.

Can I get the creation date from an ObjectId?

Yes. The first 8 hex characters are a Unix timestamp in seconds, which most MongoDB drivers can convert to a date.

How many ObjectIds can I generate at once?

Up to 200 per batch.

Need random data? Get it now.

Pick any of 144 generators, hit Generate and copy or export the results as CSV, JSON or TXT. No account, no limits, nothing stored.

Start generating — free