MongoDB ObjectId

Client

A BSON ObjectId is 12 bytes shown as 24 hex digits: four-byte big-endian Unix time, three-byte machine id, two-byte process id, and a three-byte counter. Parse existing ids or generate new ones locally—useful next to JSON ↔ BSON and time tools.

Compare time ordering with ULID and UUID v7. Convert the embedded second with the Unix timestamp workspace for time zones and ISO strings.

Parse ObjectId

?

12-byte BSON value: Unix time (seconds) in the first four bytes (big-endian), then random/process fields—useful for rough document age, not a cryptographic guarantee.

Generate ObjectIds

Uses current Unix second plus eight random bytes—same 12-byte shape as MongoDB drivers for client-generated ids.

  • 69eb4f5e867a53cbbf83aa2d
  • 69eb4f5ea15b0e374d425cff
  • 69eb4f5e856d21e882434908
  • 69eb4f5e45160cd525398f2c
  • 69eb4f5e7a21c5d8ed63adc0

Common use cases

  • Read the embedded creation time from a log line or support ticket id without opening a database shell.
  • Generate placeholder ObjectIds for fixtures and API mocks that match the hex shape your UI expects.
  • Compare ObjectId timestamps with ULID or UUID v7 when choosing sortable identifiers for a new service.
  • Cross-check BSON JSON ↔ BSON conversion against the separate ObjectId field format in docs.

Common mistakes to avoid

  • Treating the timestamp as authoritative audit evidence

    Clock skew, imported data, and manually set values can make the first four bytes misleading—verify with application metadata when it matters.

  • Assuming machine and pid map to real hosts

    Drivers hash randomness into these fields; treat them as opaque entropy unless you control the generator.

  • Forgetting endianness when reading raw bytes

    ObjectId uses big-endian for the 32-bit timestamp and 16-bit process id—this page matches the wire order MongoDB uses.

FAQ

Is this the same as MongoDB’s server ObjectId?

Layout matches the 12-byte BSON type. Values generated here use the current second plus random trailing bytes, like typical client drivers—not the exact server monotonic counter.

Can I paste Extended JSON like {"$oid": "…"}?

Strip to the 24 hex characters (or use ?q= with the hex). This page does not parse full EJSON wrappers.

Prefill from a URL?

Yes—?q= or ?qb= fills the parse field with hex text.

Common search terms

Phrases people search for that match this tool. See the full long-tail keyword index.

  • mongodb objectid parser online
  • decode objectid timestamp hex 24
  • generate objectid browser local
  • bson objectid machine pid counter

Related utilities you can open in another tab—mostly client-side.