MongoDB ObjectId Decoder

Paste a MongoDB ObjectId and see its embedded timestamp, random value, and counter decoded instantly.

Enter ObjectId

Byte layout

A 12-byte ObjectId splits into a 4-byte timestamp, a 5-byte random value, and a 3-byte counter, shown below as 24 hex characters.

Enter an ObjectId on the left to decode it

Copied!

Summary

Paste a MongoDB ObjectId and see its embedded timestamp, random value, and counter decoded instantly.

How it works

  1. Paste or type a 24-character hex ObjectId into the input field.
  2. The tool validates the format and decodes it as you type.
  3. View the embedded Unix timestamp and creation date/time.
  4. View the 5-byte random value and 3-byte counter segments.
  5. Click "Generate Random" to produce a valid sample ObjectId for the current time.

Use cases

  • Find out when a MongoDB document was created from its _id.
  • Debug a document by inspecting the ObjectId structure without a database client.
  • Verify that a string is a well-formed 24-character hex ObjectId.
  • Generate a sample ObjectId for a given moment for testing or fixtures.
  • Explain to a teammate how MongoDB ObjectIds encode a timestamp.
  • Check whether two ObjectIds were created around the same time.

Frequently Asked Questions

Last updated: 2026-07-24 · Reviewed by Nham Vu