MX (.mx)

Mathematica serialized package format.
Used for the distribution of Mathematica packages.
Stores arbitrary Mathematica expressions in a serialized format optimized for fast loading.
Binary file format.
MX files cannot be exchanged between different operating systems or versions of Mathematica.
Developed by Wolfram Research.
  • Import and Export fully support Mathematica MX files.
  • Mathematica MX files can be created with DumpSave and read with Get.

Import and ExportImport and Export

  • Import[""] reads in an MX file and returns an expression.
  • Export["", expr] serializes an arbitrary Mathematica expression and saves it as an MX file.
  • Import["", elem] imports the specified element from an MX file.
  • The import format can be specified with Import["file", "MX"] or Import["file", {"MX", elem, ...}].
  • Import[""] is equivalent to Get[""].
  • See the reference pages for full general information on Import and Export.
  • ImportString and ExportString support the MX format.


  • General Import elements:
  • "Elements"list of elements and options available in this file
    "Rules"full list of rules for each element and option
    "Options"list of rules for options, properties, and settings
  • Import elements:
  • "Expression"reads and evaluates all expressions, returning the last one
    "HeldExpression"list of unevaluated expressions
  • Import by default uses the element for Mathematica MX files.

ExamplesExamplesopen allclose all

Basic Examples (1)Basic Examples (1)

Export an arbitrary Mathematica expression to the MX format:

Click for copyable input
Click for copyable input

Show the available Import elements:

Click for copyable input

Import as an expression:

Click for copyable input
New in 4 | Last modified in 6
New to Mathematica? Find your learning path »
Have a question? Ask support »