BinarySerialize—Wolfram Documentation

Details and Options

Examples

open all close all

Basic Examples  (2)

Serialize an expression:

Serialize a graphic:

Convert the serialized form back to an expression:

Scope  (7)

Options  (4)

Method  (3)

Create a packed array of integer values:

By default, BinarySerialize uses the smallest integer type that fits the data:

Serialize the packed array using a bigger integer type:

Create a packed array of real values:

Serialize the array:

Serialize the array using machine floats, trading precision for a smaller output:

Create a packed array of complex values:

Serialize the array:

Serialize the array using lower precision:

PerformanceGoal  (1)

Applications  (1)

Serialize a trained neural network:

Create a new file:

Open an output binary stream:

Write the serialized expression to the file:

Read the data from the file:

Plot the prediction of the net as a function of the input:

Properties & Relations  (4)

Possible Issues  (2)

From small expressions, PerformanceGoal->"Size" may not produce smaller outputs:

The Method parameter "PackedArrayIntegerType" must be chosen consistently with the data:

These values require 32-bit integers:

A setting of Automatic will always use a size that fits the data:

Wolfram Research (2017), BinarySerialize, Wolfram Language function, https://reference.wolfram.com/language/ref/BinarySerialize.html (updated 2018).

Text

Wolfram Research (2017), BinarySerialize, Wolfram Language function, https://reference.wolfram.com/language/ref/BinarySerialize.html (updated 2018).

CMS

Wolfram Language. 2017. "BinarySerialize." Wolfram Language & System Documentation Center. Wolfram Research. Last Modified 2018. https://reference.wolfram.com/language/ref/BinarySerialize.html.

APA

Wolfram Language. (2017). BinarySerialize. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/BinarySerialize.html

BibTeX

@misc{reference.wolfram_2025_binaryserialize, author="Wolfram Research", title="{BinarySerialize}", year="2018", howpublished="\url{https://reference.wolfram.com/language/ref/BinarySerialize.html}", note=[Accessed: 22-February-2026]}

BibLaTeX

@online{reference.wolfram_2025_binaryserialize, organization={Wolfram Research}, title={BinarySerialize}, year={2018}, url={https://reference.wolfram.com/language/ref/BinarySerialize.html}, note=[Accessed: 22-February-2026]}