How to Convert BSON to CSV - Step by Step Guide
Input Your BSON Data
Let's convert your BSON data to CSV format! Whether you're exporting MongoDB collections to spreadsheets, analyzing database data in Excel, or preparing reports, you have several convenient options:
Example: BSON Input (Base64)
Two MongoDB documents written back to back, as mongodump does, then Base64-encoded:
fAAAAAdfaWQAZzi256sSzTTvVniQAm5hbWUADgAAAFJvYmVydCBXaWxzb24AAmVtYWlsABMAAAByb2JlcnRAZXhhbXBsZS5jb20AEGFnZQAeAAAAAmRlcGFydG1lbnQADAAAAEVuZ2luZWVyaW5nAAhpc0FjdGl2ZQABAHUAAAAHX2lkAGc4tuerEs0071Z4kQJuYW1lAAsAAABKYW5lIFNtaXRoAAJlbWFpbAARAAAAamFuZUBleGFtcGxlLmNvbQAQYWdlABwAAAACZGVwYXJ0bWVudAAKAAAATWFya2V0aW5nAAhpc0FjdGl2ZQAAAA==
Configure Conversion Options
Customize how your BSON data is converted to CSV format:
Example: CSV Output
The same BSON, now converted to CSV format:
_id,name,email,age,department,isActive 6738b6e7ab12cd34ef567890,Robert Wilson,robert@example.com,30,Engineering,true 6738b6e7ab12cd34ef567891,Jane Smith,jane@example.com,28,Marketing,false
Export Your CSV Data
Once the CSV looks right, take it with you:
Frequently Asked Questions
How do I convert BSON to CSV from MongoDB?
Upload the .bson file that mongodump wrote, or paste the BSON bytes as Base64 or Hex. Each document becomes one row and every field becomes a column. Documents with different fields are fine: the columns are the union of all of them, and a document without a field just gets an empty cell.
What happens to nested MongoDB documents and arrays?
With "Flatten Nested Objects" on, a nested document turns into dotted columns such as address.city, and array items get their position, so tags: ["a", "b"] becomes tags.0 and tags.1. With it off, each nested value is written into its cell as compact JSON text instead.
How are MongoDB-specific types written?
ObjectId becomes its 24-character hex string, Date becomes ISO 8601 in UTC (2024-01-15T10:30:00.000Z), Binary and UUID become Base64, and Decimal128 keeps its exact digits, so 14.50 stays 14.50. Rarer types such as Timestamp or MinKey are written as canonical Extended JSON.
Will long numbers like 8901240544102066246 survive?
Yes. BSON int64 values are read as exact integers, so IDs such as 8901240544102066246 or -9223372036854775808 appear in the CSV with every digit, and text like 00501 keeps its leading zeros. Be careful when opening the file in Excel, though: Excel itself rounds numbers after 15 digits and drops leading zeros, so import those columns as text if you need them as they are.
What CSV format does the converter produce?
Comma-separated values with a header row (you can switch it off). A value is wrapped in double quotes when it holds a comma, a quote, a line break or leading or trailing spaces, and quotes inside are doubled, following RFC 4180. The downloaded file starts with a UTF-8 byte order mark so Excel shows accents and emoji correctly; copied text has no mark.
Is my data uploaded anywhere?
No. The BSON is decoded and turned into CSV in your browser, nothing you paste or upload is sent to our server, and a reload starts with an empty editor. Very large dumps are limited by your browser memory and can take a few seconds, so for a huge collection mongoexport --type=csv may be the better route.