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
ObjectId
000000000000000000000000
Timestamp (hex)
-
Random value (hex)
-
Counter (hex)
-
Unix timestamp (seconds)
-
Created (UTC)
-
Created (local time)
-
Counter (decimal)
-
Copied!
Summary
Paste a MongoDB ObjectId and see its embedded timestamp, random value, and counter decoded instantly.
How it works
- Paste or type a 24-character hex ObjectId into the input field.
- The tool validates the format and decodes it as you type.
- View the embedded Unix timestamp and creation date/time.
- View the 5-byte random value and 3-byte counter segments.
- 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