.MAT

MAT File

MATLAB MAT-File (Data)
Ask a question
QUICK ANSWER

A MAT file is almost always a MATLAB data file - a binary container holding named variables (matrices, arrays, structs) saved from a MATLAB session. Open it for free in GNU Octave or read it in Python with SciPy (older files) or h5py (v7.3 files, which are actually HDF5). It cannot be opened in Excel directly; export to CSV first.

Developer: MathWorks Category: Data Files Open standard MIME: application/x-matlab-data
OPENS ON Windows macOS Linux
Related: .PKPASS · .DAT · .JSON · .RIS

On this page

19k+ extensions indexed
Last reviewed Jun 28, 2026

Not sure what your file is?

Drop any file into our identifier - we read just the first bytes to name the format.

Identify a file

What is the MAT file format?

.mat is a binary data file used by MATLAB - MathWorks' technical computing environment - to store named workspace variables. Arrays, matrices, structs, cell arrays and strings are all packed into a single .mat file, letting analysts save an entire working session and reload it exactly as it was left.

The format has evolved through several generations. The dominant Level 5 container, introduced in 1996, begins with a 128-byte ASCII descriptive header - the first bytes read MATLAB 5.0 MAT-file - followed by a sequence of tagged data elements (miMATRIX records) that each carry a variable name, data class and dimensions alongside the raw array bytes. Format v7 added optional per-variable DEFLATE (zlib) compression while keeping this same structure. MAT-file v7.3, shipped with MATLAB R2006b (2006), quietly switches the container to HDF5 - which is why some .mat files open in generic HDF5 tools such as HDFView while older ones do not. The v7.3 format also removes Level 5's practical ~2 GB per-variable size limit.

Saving and loading .mat files in MATLAB uses the save and load commands; pass -v7.3 to save to select the HDF5 backend. GNU Octave reads and writes both Level 5 and v7.3 natively. In Python, scipy.io.loadmat handles Level 5, while h5py tackles v7.3. Data can also be exchanged with .csv files for simpler tabular results. The registered MIME type is application/x-matlab-data.

Security & safety

RISK: LOW

A .mat data file is passive - it stores numbers and strings, not executable code, so opening one to read its variables is low-risk. Two caveats: (1) MATLAB function handles and objects can be serialized into a .mat, and loading them can, in narrow cases, invoke class code - treat .mat files from untrusted sources with the same caution as any data you'll run through scripts; (2) a v7.3 .mat is an HDF5 file, so use a maintained HDF5/MAT reader. There's no macro-style auto-execution as in Office documents.

Format details

in a nutshell
FULL NAMEMATLAB MAT-File (Data)aka MATLAB data file, MAT-file
DEVELOPERMathWorkssince MAT-file Level 5 format with MATLAB 5 (1996); v7.3 (HDF5-based) added in MATLAB 7.3 (2006)
CATEGORYData Files
MIME TYPEapplication/x-matlab-data
TYPEBinary scientific data container (arrays/variables); v7.3 is HDF5-based
STANDARDOpen · royalty-free
This extension is also used by…
  • 3ds Max / game-engine material file - Some 3D and game tools use .mat for a material definition (shaders/textures), unrelated to MATLAB.
  • Audiotool .mat session - The online Audiotool music studio saves projects with a .mat extension.
  • Microsoft Access table shortcut - Legacy: a small pointer launching an Access table - the (incorrect) name recorded in this site's database.
MAGIC BYTES · FILE SIGNATURE
OFFSET
000102030405060708090a0b0c0d0e0f101112
HEX
4D41544C414220352E30204D41542D66696C65
ASCII
MATLAB 5.0 MAT-file
Level 5 / v6 / v7 MAT-files begin with the ASCII header text "MATLAB 5.0 MAT-file …" in a 128-byte descriptive header (the first 116 bytes are text, followed by subsys offset and a 2-byte version + endian-indicator "MI"/"IM"). MAT-file v7.3 is instead a standard HDF5 file, so it starts with the HDF5 signature 89 48 44 46 0D 0A 1A 0A ("\x89HDF\r\n\x1a\n") and has a userblock whose first bytes read "MATLAB 7.3 MAT-file". Pre-1996 Level 4 MAT-files have no text header.

Programs that open MAT files

Windows4 apps
MATLAB Paid Double-click or use load('file.mat') to bring the variables into the workspace. Native, full fidelity.
GNU Octave Open-source Free MATLAB-compatible clone; use load file.mat to read variables (reads Level 5 and most v7.3 files).
Python (SciPy / h5py) Open-source scipy.io.loadmat('file.mat') for v5-v7; for v7.3 use h5py (it's HDF5). Great for converting to CSV/NumPy.
HDFView (v7.3 only) Free Open a v7.3 .mat as HDF5 to browse datasets/groups. Won't open older Level 5 .mat files.
macOS3 apps
MATLAB Paid load('file.mat') in MATLAB on macOS to read the variables.
GNU Octave Open-source Free clone; load file.mat reads the variables. Install via Homebrew or the official package.
Python (SciPy / h5py) Open-source scipy.io.loadmat for older files, h5py for v7.3. Ideal for scripting/export.
Linux3 apps
MATLAB Paid load('file.mat') in MATLAB for Linux.
GNU Octave Open-source apt/dnf install octave; load file.mat to read the variables. The free go-to on Linux.
Python (SciPy / h5py) Open-source scipy.io.loadmat (v5-v7) or h5py (v7.3) to read and convert MATLAB data.

Technical details

deep spec
DeveloperMathWorks
Format typeBinary scientific data container (arrays and named variables); v7.3 uses HDF5 on disk
Format versionsLevel 4 (legacy, pre-1996), Level 5 (MATLAB 5-7), v7.3 (HDF5-based, R2006b onward)
Level 5 file signatureASCII text "MATLAB 5.0 MAT-file" in a 128-byte descriptive header starting at byte offset 0
v7.3 file signatureHDF5 magic bytes 89 48 44 46 0D 0A 1A 0A at offset 0; HDF5 userblock opens with "MATLAB 7.3 MAT-file"
Byte orderSelf-described: "MI" = big-endian, "IM" = little-endian, stored at bytes 126-127 of the Level 5 header; v7.3 (HDF5) records its own byte-order metadata
Supported data typesdouble, single, int8/16/32/64, uint8/16/32/64, complex arrays, char, logical, struct, cell array, function handle
CompressionOptional per-variable DEFLATE (zlib) in Level 5 v7; HDF5 gzip/deflate filter available in v7.3
Per-variable size limitLevel 5: ~2 GB per variable; v7.3 (HDF5): no practical upper limit - supports arrays exceeding 2 GB
MIME typeapplication/x-matlab-data (application/matlab-mat and application/octet-stream also seen in practice)
Level 5 internal structure128-byte descriptive text header followed by a sequence of tagged miMATRIX data elements, each storing variable name, class, dimensions and raw array data
HDF5 tool compatibilityv7.3 files are valid HDF5 and open in HDFView, the HDF5 C library, h5py and other HDF5-aware tools without MATLAB
Python accessscipy.io.loadmat for Level 5/v7 files; h5py or the mat73 package for v7.3 files
MATLAB save command flags-v6 or -v7 selects Level 5; -v7.3 selects the HDF5-backed format (e.g. save('data.mat','varname','-v7.3'))
Integrity checkingLevel 5 has no whole-file checksum; v7.3 (HDF5) supports optional per-dataset HDF5 checksum filters
ReleasedMAT-file Level 5 format with MATLAB 5 (1996); v7.3 (HDF5-based) added in MATLAB 7.3 (2006)
Latest versionMAT-file v7.3 (HDF5-based, supports variables > 2 GB); Level 5 still used by v6/v7
Open standardYes · royalty-free
Specificationwww.mathworks.com

MAT conversions

Community Q&A

asked by users
Ask a quick question
Get help from people who work with MAT files. Be specific - include your system and software version.
No account needed · answers usually within a day

No questions yet - be the first to ask about MAT files.

Frequently asked questions

How do I open a .mat file without MATLAB?
Use the free GNU Octave (load file.mat), or read it in Python with SciPy (scipy.io.loadmat) for older versions and h5py for v7.3 files. These let you view, plot or export the data without a MATLAB licence.
How do I convert a .mat file to CSV?
Load it in MATLAB or Octave and use writematrix/writetable, or in Python use scipy.io.loadmat (or h5py for v7.3) plus pandas to_csv. Each variable becomes its own CSV since a .mat can hold several.
Why won't scipy.io.loadmat open my .mat file?
It's probably a v7.3 file, which is actually HDF5 and not supported by loadmat. Read it with h5py instead (or re-save it as -v7 in MATLAB/Octave).
Is a .mat file the same as a MATLAB script (.m)?
No. A .mat file stores data (variables); a .m file is MATLAB source code. They often travel together but are different formats.
Can I read a .mat file in Excel?
Not directly - .mat is binary, not a spreadsheet. Convert it to CSV/XLSX first using MATLAB, Octave or Python, then open that in Excel.
What's the difference between MAT-file versions (v6, v7, v7.3)?
v6/v7 use the Level 5 binary format (v7 adds compression); v7.3 switches to HDF5 and supports variables larger than 2 GB. You pick the version with MATLAB's -v6/-v7/-v7.3 save flag.

References

1Library of Congress - MAT-File Level 5 File Formatwww.loc.gov
2MathWorks - MAT-File Versionswww.mathworks.com

Keep exploring

across the database

Top extensions this week

1.AQQAQQ Instant Messenger File
2.MDMarkdown Document
3.CRDOWNLOADChrome Partial Download File
4.BINCD/DVD Disc Image (BIN/CUE)
5.PARTPartial Download File
6.RPMSGRestricted Permission Message
7.NOMEDIAAndroid No-Media Marker File
8.EXEWindows Executable (Portable Executable)
9.AVIFAV1 Image File Format (AVIF)
10.ICSiCalendar data file

Related extensions

.PKPASSApple Wallet Pass (formerly Passbook)
.DATProgram Data File (generic)
.JSONJavaScript Object Notation file
.RISResearch Information Systems citation file
.OFXOpen Financial Exchange
.CSVComma-Separated Values

Free file tools

An in-browser file identifier and image converter - everything runs on your device.

Open the toolbox

Browse file extensions A-Z