Loading BSON Validator...
Please wait a moment

How to Validate BSON - Step by Step Guide

Step 1

Input Your BSON Data

Let's validate your BSON data! Whether you're working with MongoDB exports, checking data integrity, or debugging import issues, you have several convenient options:

•
Paste directly: Copy your BSON data in Base64 or Hex format from MongoDB exports, mongodump, or binary data tools
•
Upload a file: Click "Upload" to select a .bson or .bin file from your computer. A mongodump file with many documents back to back is checked document by document
•
Try the sample: Click "Sample" to load example MongoDB document and see how validation works

Example: BSON Input (Base64)

Here's what encoded BSON data looks like:

bAAAAAdfaWQAZzi256sAAAAAAAAAAm5hbWUADgAAAEFsaWNlIEpvaG5zb24AAmVtYWlsABMAAABhbGljZUB0ZWNoY29ycC5jb20AEGFnZQAgAAAAEHNhbGFyeQAYcwEACGlzQWN0aXZlAAEA
Step 2

Automatic Validation & Analysis

The magic happens instantly! As soon as you input BSON data, the validator automatically:

•
Validates integrity: Checks binary structure and ensures BSON is well-formed
•
Detects MongoDB types: Identifies ObjectId, Date, Binary, Decimal128, Timestamp, and other special types
•
Analyzes structure: Shows document size, field count, and nesting levels for complexity assessment

Example: Validated & Decoded Output

The same BSON, now validated and shown as readable JSON:

{
  "_id": {
    "$oid": "6738b6e7ab00000000000000"
  },
  "name": "Alice Johnson",
  "email": "[email protected]",
  "age": 32,
  "salary": 95000,
  "isActive": true
}
Step 3

Export Your Validated Data

Get your validated BSON data ready for use! Multiple export options make it easy to integrate into your workflow:

•
Copy to clipboard: One-click copying of validated JSON for quick pasting into MongoDB Compass, applications, or documentation
•
Download as JSON: Save the validated output as a .json file for debugging, analysis, or sharing with your team
•
View validation stats: See document size, field count, nesting levels, and detected MongoDB types at a glance

Frequently Asked Questions

How do I validate BSON data from MongoDB?

Paste the BSON as Base64 or Hex, or upload the .bson file that mongodump wrote. The check runs as soon as the input changes: every document is decoded, and you either get the decoded JSON with its size, field count and nesting depth, or a message that says what is wrong, such as a bad character with its line and column, or a document that was cut off.

What's the difference between Base64 and Hex format?

They are two text spellings of the same bytes. Base64 (A-Z, a-z, 0-9, + and /) is shorter, so it is what most APIs and logs use. Hex (0-9 and A-F, two digits per byte) is longer but easy to read byte by byte. Pick the one you pasted; if you choose the wrong one, the validator tells you. Switching the format rewrites valid input in the other spelling.

What MongoDB data types are detected?

Each special BSON type found anywhere in the data gets a tag under the output: ObjectId, Date, Long (64-bit integer), Decimal128, Binary, Timestamp, RegExp, MinKey, MaxKey, Code, Symbol and DBRef. Plain strings, booleans, 32-bit integers and doubles are not tagged.

Can I export the validated BSON data?

Yes. Copy puts the decoded JSON on your clipboard and Download saves it as validated-bson.json. The output is relaxed Extended JSON: ObjectIds, dates, binary data and decimals keep their $oid, $date, $binary and $numberDecimal wrappers, and long integers such as 8901240544102066246 are written with every digit. Ordinary numbers become plain JSON numbers, so the difference between a BSON int32, int64 and double is not kept in the text.

Does the validator fix corrupted BSON?

No. It reports the first problem it finds, for example a length header that does not match the data, stray bytes after the last document, or JSON text pasted where BSON was expected, and leaves the input as it is so you can fix it at the source.

Is my data uploaded anywhere?

No. Decoding and checking happen in your browser, and nothing you paste or upload is sent to our server. The tool is free and needs no account. Very large files are limited only by your browser memory, and a big upload can take a few seconds to show.