MongoDB ObjectId Decoder

Paste a MongoDB ObjectId to see the creation timestamp, the random value and the counter packed inside it. Everything is decoded in your browser.

1 Fill in the box

2 Your answer

Your answer shows here as you type.

How to use the MongoDB ObjectId Decoder

  1. Paste a 24-character MongoDB ObjectId, with or without the ObjectId(...) wrapper.
  2. Read the timestamp, which is the time the ObjectId was generated, in UTC.
  3. Check the random value and counter, which are the other parts of the ObjectId.

Frequently asked questions

What is inside a MongoDB ObjectId?

A 12-byte value (24 hex characters): a 4-byte Unix timestamp in seconds, a 5-byte random value, and a 3-byte counter that starts at a random number and increases.

Does an ObjectId show when a document was created?

Only as the time the ObjectId was generated by the driver or server, with one-second precision. It is not a reliable record of when a document was saved if the ID was set by the application.

Is the ObjectId timestamp in UTC?

Yes. The first four bytes are seconds since 1970-01-01 00:00:00 UTC, so the decoded time is always UTC.

Wrote something with AI? Slop Monkey rewrites it so it sounds like you, and keeps your facts.