EditSafely

Generate Random BSON

Generate random BSON (Binary JSON) files. Runs entirely in your browser, so your data never leaves your device.

Output

The result appears here as you type.

Options

How to use Generate Random BSON

  1. 1. Set the number of fields. Enter Number of fields to decide how many key-value entries the generated BSON document contains before it gets encoded to bytes.
  2. 2. Set a separator. Choose Separator to control how the resulting hex byte pairs are joined in the text output, such as a space between each byte.
  3. 3. Read the byte output. The result prints the document's raw bytes as hex pairs, following BSON's length-prefixed, type-tagged binary structure used by MongoDB.
  4. 4. Copy the bytes. Copy the hex byte sequence into a hex editor, a MongoDB wire protocol test, or documentation showing how BSON encodes a document.

When to use Generate Random BSON

Generate Random BSON builds a small BSON (Binary JSON) document with a chosen number of fields and outputs its raw bytes as hex, the format MongoDB uses internally to store and transmit documents.

  • Learning how BSON encodes a document. A developer new to MongoDB internals wants to see the actual byte layout of a document, including type tags and length prefixes, rather than just reading the spec.
  • Testing a BSON parser implementation. Someone writing a custom BSON decoder in a language without an existing library wants sample byte sequences to confirm the parser reads field types and lengths correctly.
  • Comparing BSON size against equivalent JSON. A developer curious how much overhead BSON's type tags and length prefixes add generates a sample document to compare its byte size against the same data in JSON.
  • Debugging a MongoDB wire protocol issue. An engineer troubleshooting a driver-level bug wants a known-structure BSON byte sequence to trace through a packet capture and confirm field boundaries.

Examples

Three-field BSON document as hex bytes

Output

22 00 00 00 10 63 65 64 61 72 00 e8 03 00 00 00

About the Generate Random BSON tool

Generate Random BSON does its work locally, right in the browser. Generate random BSON (Binary JSON) files. There is no upload step, no queue and no account, and your data never travels over the network.

It belongs to the Random Tools collection on EditSafely, a set of 120 small, focused Random utilities that share the same instant, private workspace.

You can shape the output with 2 settings, including Number of fields and Separator, and the result refreshes the moment you change one. A worked example further down the page shows exactly what the tool produces for a real input.

Running locally also makes the tool fast and dependable: results appear as you type or drop a file, there is no server outage that can take it down mid-task, and confidential data can be processed without a second thought.

Frequently asked questions

Is Generate Random BSON free to use?

Yes, it is completely free. All 2,658 tools on EditSafely work without an account, a subscription or usage limits.

Does the generator send anything to a server?

Everything happens locally. Your browser downloads the tool's code once, then does all the processing itself; nothing you enter is transmitted, stored or logged. You can even go offline after the page loads and it will still work.

How do I get a different result?

Run the generator again. Each run is computed fresh on your device, and any options you change are applied to the next result immediately.

Do I need to sign up or install anything?

No. The tool works in any modern browser on desktop, tablet or phone. There is no account to create, no extension to add and no software to install.

How do I use the result?

The output panel has a one-click copy button, and you can keep refining the input while you work; the result updates in place as you type.