.mdf

How to Open MDF File: SQL Server Database or Disc Image?

Two unrelated formats use .mdf. Most often it's a Microsoft SQL Server database file, which you open by attaching it to SQL Server. Older .mdf files are Alcohol 120% disc images of a CD or DVD, which you mount or convert to ISO. The free tool below tells you which kind you have. For disc images, it even converts the MDF to a standard ISO in your browser, so you can open MDF files on Windows, Mac or Linux without extra software.

Category: Database / disc image Used by: Microsoft SQL Server; Alcohol 120% Partner files: .ldf (SQL) or .mds (disc)

Choose what you need

Open MDF File Online: Identify It & Convert MDF to ISO (Free)

Drop an .mdf below, of any size; only small parts are read. The tool recognizes SQL Server data files (by their 8 KB page structure) and Alcohol disc images (raw 2,352-byte or 2,048-byte sectors). For discs it shows the volume label, size and file system, and converts data discs to an ISO file right in your browser.

Good to know: audio CDs and copy-protected game discs can't become a working ISO; the tool tells you when that's the case. It doesn't open the tables inside a SQL Server database. That requires SQL Server.

🔒 Nothing is uploaded — your file never leaves this device

What is an MDF file?

An MDF file is either a SQL Server primary database file or an Alcohol 120% disc image; the two share only the extension. A SQL Server .mdf ("master data file") holds a database's tables and is normally paired with an .ldf transaction log. An Alcohol .mdf ("media data file") holds a sector-by-sector copy of a CD or DVD, with a small .mds file describing tracks and copy-protection details.

SQL Server MDFDisc image MDF
Made byMicrosoft SQL ServerAlcohol 120% / 52% and compatible tools
Partner file.ldf (log), sometimes .ndf.mds (descriptor)
Typical locationSQL Server's DATA folder, app foldersDownloads, backup drives
Open withSQL Server (attach)Virtual drive tool, or convert to ISO
SizeMultiple of 8 KBAbout a CD (≤ 900 MB) or DVD (≤ 8.5 GB)
Two kinds of MDF file A SQL Server MDF is made of 8 KB pages, the first being the file header page. An Alcohol MDF disc image is made of CD sectors of 2,352 bytes, each with a sync pattern, a header and 2,048 bytes of data. SQL Server MDF: 8 KB pages file header PFS GAM … data pages (tables) Disc image MDF: 2,352-byte CD sectors sync 12 header 4 data 2,048 → ISO ECC 288
Illustration: the structures the tool uses to tell the two MDF types apart. Keeping only the 2,048 data bytes of each sector produces an ISO.

How to open an MDF file: quick answer

ClueIt's probably…Do this
An .ldf file with a similar name nearbySQL Server databaseAttach it in SQL Server
An .mds file with the same nameDisc imageConvert to ISO or mount the .mds
Came with an old game or software downloadDisc imageMount or convert
Not sure—The tool above tells you in a second

Attach a SQL Server MDF file

You need SQL Server (Express is free; in SQL Server 2025 it handles databases up to 50 GB) and SQL Server Management Studio. Ideally also the matching .ldf.

  1. Copy the .mdf and .ldf into a folder the SQL Server service account can read, such as SQL Server's DATA folder.
  2. In SSMS, connect, right-click Databases and choose Attach…
  3. Click Add, select the .mdf, and check the Database details grid: every file needs a valid path. If the log shows "Not found", remove it from the grid to have SQL Server create a new one.
  4. Click OK. The database appears under Databases.

With T-SQL:

CREATE DATABASE SalesDB
ON (FILENAME = 'C:\Data\SalesDB.mdf'),
   (FILENAME = 'C:\Data\SalesDB_log.ldf')
FOR ATTACH;

-- log file missing (database was shut down cleanly):
CREATE DATABASE SalesDB ON (FILENAME = 'C:\Data\SalesDB.mdf')
FOR ATTACH_REBUILD_LOG;

One-way upgrade: attaching to a newer SQL Server upgrades the database, and it can't go back to the older version afterwards. Work on a copy if you might need the original. Microsoft also recommends running DBCC CHECKDB on a non-production server before using a database from an unknown source.

Open an MDF disc image

Windows 11/10 and macOS mount ISO files natively, but not MDF. You have two options:

  • Convert to ISO (best for data discs): use the tool above, then double-click the ISO (Windows: right-click > Mount). See our ISO guide.
  • Mount with a virtual drive program such as Alcohol 52% or DAEMON Tools Lite: open the .mds file (it points to the .mdf). This is the way to go for audio CDs, mixed-mode discs and copy-protected games, which rely on details stored in the .mds.

If the tool says "2,048-byte sectors", the MDF is already a plain ISO inside: renaming a copy to .iso works too. Our MDS guide covers the descriptor file.

Convert MDF to ISO

  1. Drop the .mdf into the tool.
  2. Check that it found a file system (ISO 9660, Joliet or UDF) and the volume label.
  3. Click Convert to ISO. The browser builds the ISO from your file locally and saves it to your Downloads.
  4. Open the ISO: Windows (right-click > Mount), Mac (double-click), Linux (open with Disk Image Mounter or sudo mount -o loop file.iso /mnt).

Multi-session discs and discs with several tracks keep only the data track that starts at the beginning of the image; use a virtual drive with the .mds for those.

MDF errors and fixes

"Unable to open the physical file… Operating system error 5: Access is denied" (SQL error 5120)

The SQL Server service account can't read the folder. Move the files into SQL Server's DATA folder, or give the service account read/write permission.

"The database cannot be opened because it is version …"

The MDF comes from a newer SQL Server than yours. Install the same or a newer version (Developer or Express), or ask for a script or export instead.

Log file missing

Use FOR ATTACH_REBUILD_LOG. It only works if the database was shut down cleanly; otherwise restore from a .bak backup. See our BAK guide.

The .mds file is missing

Convert the MDF to ISO with the tool above; data discs don't need the .mds. Audio and protected discs do.

"The disc image file is corrupted" after renaming to .iso

The MDF uses raw 2,352-byte sectors, which ISO readers don't understand. Use the converter instead of renaming.

Sources and technical references

Frequently asked questions

How do I open an MDF file?

First check which kind it is. A SQL Server MDF is attached to SQL Server with SQL Server Management Studio (Databases > Attach). An Alcohol disc image MDF is mounted with a virtual drive tool or converted to ISO, which Windows and macOS open natively. The tool on this page tells you which one you have.

How do I convert MDF to ISO?

Drop the MDF into the tool on this page and click Convert to ISO. It keeps the 2,048 data bytes of each disc sector and saves a standard ISO, all in your browser. If the MDF already uses 2,048-byte sectors, renaming a copy to .iso also works.

How do I attach an MDF file in SQL Server?

In SQL Server Management Studio, right-click Databases, choose Attach, click Add and select the MDF, check that every file in the grid has a valid path, then click OK. With T-SQL use CREATE DATABASE … ON (FILENAME = '…mdf') FOR ATTACH.

Can I open an MDF file without the LDF file?

Often yes. If the database was shut down cleanly, use CREATE DATABASE … FOR ATTACH_REBUILD_LOG, or remove the missing log from the Attach dialog, and SQL Server creates a new log. If it wasn't shut down cleanly, restore from a backup instead.

Can I open an MDF file without SQL Server?

To read the tables, you need SQL Server; the free Express edition is enough for databases up to 50 GB in SQL Server 2025. There's no reliable viewer that reads all MDF data directly. Disc image MDFs don't need SQL Server at all.

Why does SQL Server say access is denied when attaching?

Error 5120 with operating system error 5 means the SQL Server service account can't read the files' folder. Move the MDF and LDF into SQL Server's DATA folder or grant the service account permissions on the folder, then attach again.

Can I open an MDF disc image on Windows 11?

Windows mounts ISO files natively but not MDF. Convert the MDF to ISO with the tool on this page and right-click the ISO > Mount, or install a virtual drive program like DAEMON Tools Lite and open the matching .mds file.

What is the MDS file next to my MDF?

It's the descriptor Alcohol 120% creates with a disc image: it records the track layout and copy-protection details, while the MDF holds the data. Data discs can be converted without it; audio CDs and protected games need it to be mounted correctly.

Can I open an MDF file on Mac?

For disc images, convert the MDF to ISO with the tool on this page and double-click the ISO. For SQL Server MDF files, run SQL Server in Docker on the Mac or use a Windows machine, then attach the database with SQL Server tools.

What's the difference between MDF, LDF and NDF?

In SQL Server, the MDF is the primary data file with the database's tables and startup information, the LDF is the transaction log, and NDF files are optional secondary data files. All of them are needed together when attaching a database.

Last updated .