This is documentation for Mathematica 9, which was
based on an earlier version of the Wolfram Language.
View current documentation (Version 11.2)

Binary Data

Mathematica provides high-performance reading and writing of binary data, to both files and pipes. A convenient symbolic format representation makes it straightforward to translate published instrumentation or logging specifications to a form that can immediately be used in Mathematica.


BinaryRead read one binary object or block of objects

BinaryReadList repeatedly read a binary object or block of objects

BinaryWrite write a sequence of binary objects with specified types

Import, Export import, export complete binary files

Binary Types

"Bit" individual binary bits (Import, Export only)

"Byte" 8-bit unsigned integer

"Integer8", "Integer16", ... 8-, 16-, 24- 32-, 64-, 128-bit signed integers

"UnsignedInteger8", ... 8-, 16-, 24-, 32-, 64-, 128-bit unsigned integers

"Real32", "Real64", "Real128" IEEE single-, double-, quad-precision real numbers

"Complex64", "Complex128", "Complex256" IEEE complex numbers

"Character8", "Character16" 8- and 16-bit (Unicode) characters

"TerminatedString" null-terminated string

ByteOrdering option for byte ordering (+1 for big endian; -1 for little endian)

$ByteOrdering native byte ordering on your computer system

ToCharacterCode, FromCharacterCode character code conversion

Compress, Uncompress convert expressions to and from compressed strings