Skip to content

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.

Reset

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.

About OneClick Pro

OneClick Pro is a free collection of more than 150 web tools for everyday work: converting images and units, formatting and validating code, checking domains and SEO, and working with text, dates and numbers. Every tool runs without registration or subscription, and what you enter is only used to calculate your result and is never stored. Use it as a quick toolbox for one-off tasks, or bookmark the tools you rely on every day.