Skip to content

MongoDB ObjectId Generator & Timestamp Converter

Generates MongoDB ObjectIds, shows the creation date inside any ObjectId, and makes an ObjectId from a date for range queries.

Your ObjectId stays on this device

This tool runs entirely inside your web browser. Your ObjectId is processed on your own device and is never sent to our servers. How this works

MongoDB’s default _id: 24 hex characters that include the creation time.

Your ID

MongoDB ObjectId Generator is a free tool that creates valid ObjectIds, reads the creation date and time hidden in any ObjectId, and turns a date into an ObjectId you can use in range queries. It works entirely in your browser.

How to use it

What’s inside an ObjectId

An ObjectId such as 507f1f77bcf86cd799439011 is 12 bytes, written as 24 hexadecimal characters:

Because the time comes first, ObjectIds sort roughly by creation time, and every document effectively carries a “created at” timestamp for free. For other timestamps, the Unix Timestamp Converter reads seconds and milliseconds.

Querying by date with ObjectIds

If a collection has no createdAt field, you can still select documents by creation time using the_id index:

// Orders created on or after 1 September 2026, 00:00 UTC
db.orders.find({ _id: { $gte: ObjectId("6a9615800000000000000000") } })

Use $lt with the ObjectId of a later date to set an end. Times are rounded to the second, and the clock of the server or application that created each document is what counts.

ObjectId or UUID?

ObjectIds are MongoDB’s default and are smaller (12 bytes versus 16). UUIDs are a cross-platform standard, used by SQL databases and most other systems. If you need IDs that sort by time outside MongoDB, UUID v7 is the modern equivalent; generate them with the UUID Generator.

Frequently asked questions

What is a MongoDB ObjectId?

The default _id MongoDB gives every document: 12 bytes written as 24 hexadecimal characters. The first 4 bytes are the creation time in seconds, followed by a random value and a counter, so ObjectIds are unique and roughly sorted by creation time.

How do I get the creation date from an ObjectId?

Paste it into “Check a UUID or ObjectId”. The first 8 characters are the Unix timestamp in hexadecimal; the tool converts them to your local time and UTC. In the Mongo shell you can also use ObjectId("…").getTimestamp().

How do I find documents created after a date?

Enter the date under “Find documents by date”. The tool creates the smallest ObjectId for that second, ready to use in a query such as db.orders.find({ _id: { $gte: ObjectId("…") } }). This uses the _id index, so it is fast even on large collections.

Are generated ObjectIds safe to insert into a real database?

Yes. They follow the same structure as the MongoDB drivers, with secure random values, so they won’t clash with IDs created elsewhere. Usually you can let the driver create them for you.

Can I rely on ObjectIds being in order?

Only roughly. Ordering is by second, and IDs created in the same second on different servers can be in any order. Use a separate timestamp field when exact order matters.

Is my ObjectId sent anywhere?

No. IDs are generated and decoded in your browser; nothing is sent to a server.

Last updated

Missing a feature, or need a tool we don’t have? Suggest it.