MongoDB ObjectId Decoder
Decode MongoDB ObjectIds into creation timestamps, random values, and counters. Build date-range query boundary ObjectIds from any date range.
Loading tool...
What is MongoDB ObjectId Decoder?
The MongoDB ObjectId Decoder is a free developer tool that splits 24-character hex ObjectIds back into their three components: a 4-byte Unix timestamp, a 5-byte random value, and a 3-byte incrementing counter. It also works in reverse β turning any date range into the boundary ObjectIds you need for efficient _id range queries. Everything runs in your browser.
Key Benefits
- Recover document creation times from _id alone, with no extra date field or index.
- Debug ingestion pipelines by verifying ID generation order and time windows.
- Build fast chronological range queries directly on the _id index.
- Bulk-decode hundreds of IDs and export results as CSV.
- Keep sensitive production IDs on your machine β the tool is fully offline.
Common Use Cases
- β’Checking when a document was created from a support ticket that only shows its _id.
- β’Estimating data distribution over time without scanning the whole collection.
- β’Writing date-range queries against collections that only store _id.
- β’Auditing whether two collections were written in the same time window.
- β’Teaching and learning the internal structure of BSON ObjectIds.
How to Use MongoDB ObjectId Decoder
- Paste your ObjectIds: Copy one or more 24-character hex ObjectIds from MongoDB and paste them into the input box, one per line. ObjectId(...) wrappers are stripped automatically.
- Read the decoded table: Each row shows the creation time in your local timezone, the UTC ISO string, the 5-byte random value, and the 3-byte counter with its decimal value.
- Check the field breakdown: The detail panel splits the first valid ID into timestamp hex, unix seconds, random, and counter so you can see exactly how the 12 bytes are laid out.
- Build a range query (optional): Pick a from/to date below, and the tool generates the min and max boundary ObjectIds plus a ready-to-paste MongoDB shell query for that date range.
Key Features
- Decode creation timestamp, random value, and counter from any 24-hex ObjectId.
- Bulk decode: paste hundreds of IDs at once with per-row copy buttons.
- Export the full decoded table as CSV for spreadsheets and reporting.
- Build min/max boundary ObjectIds from a date range for fast _id range queries.
- Ready-to-paste MongoDB shell query generated from your date range.
- 100% client-side β works offline and never uploads your data.