.mat

What is a .mat file?

MAT is MATLAB's binary data format for storing matrices, arrays, structures, and workspace variables.

Safe format
Type Data
By MathWorks
MIME application/x-matlab-data

Drop any file to identify it

No upload. No signup. No sending your file halfway across the internet.
We tell you what it is, right here in your browser.

What is it

MAT files store MATLAB workspace variables — matrices, arrays, structures, cell arrays, and everything else MATLAB works with — in a binary format optimised for fast loading. When a MATLAB user saves their workspace (`save('data.mat')`), every variable in memory gets serialised into a single .mat file that can be loaded later with a single command.

The format has evolved through several versions. Version 5 (most common) stores data in a tagged binary format. Version 7.3 uses HDF5 under the hood, which means non-MATLAB tools can read it using HDF5 libraries. For interoperability, v7.3 is preferred — it's a standard format wearing a MATLAB coat.

Python's scipy.io.loadmat() reads v5 MAT files, and h5py reads v7.3 files. This makes Python the standard tool for accessing MATLAB data without a MATLAB licence. Octave (free MATLAB alternative) reads both versions natively. For sharing data outside MATLAB, exporting to CSV, HDF5, or Parquet is more portable.

Technical details
Full Name
MATLAB Data File
MIME Type
application/x-matlab-data
Developer
MathWorks
Magic Bytes
N/A
Safety
.mat is a known, safe format. Binary data file. No executable content.
What opens it
MATLAB
PAID Windows / Mac / Linux
GNU Octave
FREE Windows / Mac / Linux
Python (scipy/h5py)
FREE Windows / Mac / Linux
FAQ
How do I open a MAT file without MATLAB?
Python: `from scipy.io import loadmat; data = loadmat('file.mat')` for v5 files, or h5py for v7.3 files. GNU Octave (free MATLAB alternative) opens both versions natively.
What's the difference between MAT v5 and v7.3?
v5 is MATLAB's custom binary format. v7.3 uses HDF5 internally, making it readable by any HDF5 tool. v7.3 is created by saving with `-v7.3` flag: `save('file.mat', '-v7.3')`.
Related formats