CSV to MDF
Use this local CSV to MDF converter to build a new SQL Server data file. Choose exactly how to store each CSV column and correct rejected values before downloading.
- Free
- Works Offline
- No Uploads
How to Create MDF From CSV
- Open the HTML, review Security Check, then select Continue.
- Open a UTF-8 CSV with a comma delimiter and header row, or select Open Sample.
- Name the dbo table and review the column mappings. Choose what to do with blank cells for each numeric column.
- Select Check Mapping to preview the mapped rows. Correct any rejected values, then select Create MDF and Download.
Review the Table Before Writing
- Set column names, NVARCHAR lengths, or DECIMAL precision and scale.
- Choose how to handle blank cells and optionally add an integer primary key.
- See the CSV line and column for rejected values. The converter reads the new MDF back before it offers the download.
Formats and Compatibility
| Input | One UTF-8, comma-separated CSV with a header row. Up to 8 MiB, 50,000 data rows, and 128 columns. |
|---|---|
| Output | A new SQL Server 2025 primary .mdf file containing one mapped dbo table. |
| Browser | A modern browser with local file support. |
| Scope | Verified by native attach and DBCC CHECKDB on SQL Server 2025 LocalDB build 17.0.4025.3. Supports a single dbo table, a bounded set of scalar types, and an optional single integer primary key. |
| Operating Systems |
Local Processing Without Uploads
Use CSV to MDF without uploading files. The browser-based tool has no upload step and processes the file on your device.
Select Open Sample to see the workflow with the included example.
CSV to SQL Server MDF
Start with Unicode text to preserve identifiers like 00073. Choose an integer type or DECIMAL when the source values should have SQL numeric types. Check Mapping can flag an Amount with four fractional digits before you change the scale and retry.
Open the Result in SQL Server
The download is a new primary data file. In the tested SQL Server 2025 LocalDB build, attach a copy using the log rebuild option. The CSV tool creates one table with the declared schema and values.
Frequently Asked Questions
How do I use CSV to MDF offline?
Extract the CSV to MDF download and open CSVToMDF.html in a modern browser. The converter and Orders sample are included.
Can I use this tool to convert CSV to MDF without SQL Server?
Yes. You can run this free CSV to MDF converter without installing SQL Server. Use the tested SQL Server build to attach and query the result.
Can I run CSV to MDF in browser with blank numeric cells?
Yes. Explicitly choose SQL NULL for blank cells in that column. Choose Reject Blank Cells when the values are required.
Will DECIMAL values be rounded?
Values with more fractional digits than the chosen scale are rejected with their CSV line and column. Choose a scale that fits the source values and retry.
Does this tool work offline on Windows, macOS, Linux, and ChromeOS?
Yes. Local Studio tools run offline on Windows, macOS, Linux, and ChromeOS. Download the tool ZIP, extract it, and open the included HTML file in a supported browser. Your files are processed on your device without uploads.
Which browsers can I use with this offline tool?
Use a current version of Google Chrome, Microsoft Edge, Mozilla Firefox, or Safari where that browser is available for your operating system. Chrome is built into ChromeOS, and Safari is available on macOS.