Skip to content

MongoDB ObjectId Generator

Generate and decode MongoDB ObjectIds, including their embedded timestamp.

Quick Tool Overview

The ObjectId tool generates valid 12-byte MongoDB identifiers and decodes existing ones into their creation time, machine bytes and counter — so you can read when a document was made without querying anything.

What it does
Generates and decodes MongoDB ObjectIds
You give it
A quantity or time, or an existing ObjectId
You get back
24-character ids, or a decoded timestamp
Best for
Test fixtures, seed data and reading ids from logs
Developer Tools Free, unlimited use No sign-up Runs in your browser

About the MongoDB ObjectId Generator

A MongoDB ObjectId is 12 bytes written as 24 hexadecimal characters: a four-byte timestamp in seconds, five random bytes identifying the process, and a three-byte counter. That structure is why ObjectIds are roughly ordered by creation time.

Generating them is useful for test fixtures and seed data that has to look real. Decoding is more often the point: paste an ObjectId from a document or a log and read the exact second it was created, without querying anything. Because the timestamp is only one-second resolution, the counter is what distinguishes documents created in the same second — which is why the generator increments it rather than re-randomising.

Key features of the MongoDB ObjectId Generator

Correct structure

Four timestamp bytes, five stable random bytes and a three-byte counter, exactly as a MongoDB driver generates them.

Decoder included

Paste an _id from a document or a log and read the second it was created, with no database round trip.

Incrementing counter

Ids generated in the same second differ by their counter rather than being re-randomised, which is what the drivers do and what keeps them ordered.

Custom timestamps

Generate an ObjectId for a specific date, which makes seeded historical data look genuine.

Notes what they leak

Creation time and a stable process identifier, both of which matter if the id is ever public.

How to use the MongoDB ObjectId Generator

  1. 1

    Generate

    One or many; the timestamp is now unless you set one.

  2. 2

    Set a custom time

    Generate an ObjectId for a specific date, which is handy for seeding historical data.

  3. 3

    Decode an existing id

    Paste one to read its creation time, machine bytes and counter.

  4. 4

    Copy or download

    Take the results to your clipboard or save them.

Frequently asked questions

Yes, to the second. The first four bytes are a Unix timestamp, which is why MongoDB offers getTimestamp() on an ObjectId and why a created_at field is often redundant.

Reviews of the MongoDB ObjectId Generator

What people who use the MongoDB ObjectId Generator think of it. Reviews come from visitors and are posted as written.

No ratings yet

Yours would be the first.

  • 5 0 reviews rated 5 stars
  • 4 0 reviews rated 4 stars
  • 3 0 reviews rated 3 stars
  • 2 0 reviews rated 2 stars
  • 1 0 reviews rated 1 star

Write a review

Used this tool? Your rating helps the next person decide.

Your rating

Plain text only — links, email addresses and HTML are not accepted. Your name and review are shown publicly; nothing else is collected. See the privacy policy.

0 reviews

Newest first

No reviews yet

Be the first to rate the MongoDB ObjectId Generator. It takes half a minute and no account.

Write the first review

More developer tools