MongoDB ObjectId Decoder
Paste a MongoDB ObjectId and see its embedded timestamp, random value, and counter decoded instantly.
Use the MongoDB ObjectId Decoder
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
This decoder splits a 24-character MongoDB ObjectId into its embedded Unix timestamp, five-byte random value, and three-byte counter. It validates pasted IDs locally and can generate a sample ObjectId for the current time.
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-09-09 · Reviewed by Nham Vu