ObjectId Generator
Generate MongoDB ObjectIds: 24 hexadecimal characters made of a 4-byte timestamp in seconds, a 5-byte random value and a 3-byte counter. Use them to prepare test data, fixtures or documents with IDs you know in advance.
Frequently asked questions
What is an ObjectId?
The default _id type in MongoDB and BSON: 12 bytes written as 24 hexadecimal characters. The first 4 bytes are the creation time in seconds, then 5 random bytes chosen per process and a 3-byte counter.
Do ObjectIds sort by time?
Yes, to the second. Within one second and one process the counter keeps them in order, so ObjectIds from one batch are ascending.
Can I read the creation time?
Yes. Paste an ObjectId into the ID Decoder to see its timestamp, random value and counter.
Can I insert these IDs into MongoDB?
Yes. Wrap them as ObjectId("...") in the shell or the driver of your language. They follow the same layout MongoDB drivers generate.
Are ObjectIds secret?
No. They reveal the creation time and are not meant to be unguessable. Do not use them as access tokens.
How many can I generate?
Up to 100 per request.