Export Listing of Formats »

Export["file.ext", expr]
exports data to a file, converting it to the format corresponding to the file extension ext.

Export[file, expr, "format"]
exports data in the specified format.

Export[file, exprs, elems]
exports data by treating exprs as elements specified by elems.


  • Export handles a large number of formats, each typically with many different possible elements. The possible formats are given in the list $ExportFormats, and in the "Listing of All Formats".
  • Export["file.ext", expr] attempts to render expr in the appropriate format for the file. Among the possible forms for expr is normally the form that would be obtained from Import["file.ext"].
  • There are four common types of element specifications:
  • data representation specifications (e.g. , )
    format specifications (e.g. "GIF", "GZIP", "XLS")
    options, properties, and settings (e.g. ImageSize, SampleRate)
    metadata information (e.g. )
  • In Export[file, exprs, elems] the elements can have the following basic forms:
  • "format"use the default element for the specified format
    elemexport a single element assuming the default format
    {"format",elem}export an element assuming the specified format
    {"comp1",...,"format",...}use also compression formats (e.g. "GZIP")
    {elem1,{elem11,elem12,...}}export the as subelements of
  • Forms of elements often supported include:
  • "Data"give data in a generic form (list, string, etc.)
    "Image"give images as Image objects
    "Graphics"give graphics or geometry as a Graphics object
    "Graphics3D"give 3D graphics or geometry as a Graphics3D object
    "Sound"give sound as a Sound object
    "Grid"give a grid of data as a list or a Grid, etc.
    "Rules"give explicit rules for elements to export
  • With the element specification, the rules in exprs can have the following basic forms:
  • elem->vala value for a single element
    {elem1->val1,elem2->val2,...}values for several elements
    elem1->{elem11->val11,...}values for subelements
  • Export["!prog", expr, ...] exports data to a pipe.
  • Many options can be given using Export[file, exprs, elems, opts].
  • The names of options specific to particular formats and elements are normally strings.
  • Typical general options include Background, CharacterEncoding, ImageSize, ImageResolution, SampleRate, etc.
  • Export[file, NotebookObject[...], ...] when possible exports the content of the notebook referenced by the NotebookObject.

ExamplesExamplesopen allclose all

Basic Examples (4)Basic Examples (4)

Export an image object:

Click for copyable input

Export a plot as a GIF:

Click for copyable input

Export a formula as a GIF:

Click for copyable input
Click for copyable input

Export a sound as a MIDI file:

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