Products
  • Wolfram|One

    The definitive Wolfram Language and notebook experience

  • Mathematica

    The original technical computing environment

  • System Modeler

    Multidomain modeling and simulation of complex systems

  • Compute ServicesUse with Mathematica and Wolfram|One
  • AI AccessUse with Mathematica and Wolfram|One
  • Finance Platform
  • Wolfram|Alpha Notebook Edition
  • Application Server
  • Enterprise Private Cloud
  • Wolfram Engine
  • Wolfram Player
  • Wolfram Cloud App
  • Wolfram Player App

More mobile apps

Wolfram|Alpha

  • Wolfram|Alpha Website
  • Wolfram|Alpha APIs

AI Products

  • Wolfram AI Ecosystem
  • Wolfram Foundation Tool
  • Wolfram Cloud MCP
  • Wolfram Local MCP
  • Agent One API
  • CAG Component APIs

Core Technologies of Wolfram Products

  • Wolfram Language
  • Computable Data
  • Wolfram Notebooks
  • Linguistic Understanding

Additional Deployment Options

  • Wolfram Cloud
  • Wolfram Web Engine
  • wolframscript
  • WSTPServer
  • Group & Organizational Licensing
  • All Products
Consulting & Solutions

We deliver solutions for the AI era—combining symbolic computation, data-driven insights and deep technical expertise

Wolfram Consulting

Data Science, Finance & Business

  • Artificial Intelligence
  • Data Science
  • Healthcare
  • Real Estate

Engineering

  • Civil Engineering
  • Automotive Engineering
  • Sustainable Energy

Science & Technology

  • AgTech
  • Biosciences
  • Environmental Science
  • Food Science
  • Quantum Computation
  • Social and Behavioral Sciences

More Wolfram Solutions

Technology for Education

  • Research Universities
  • Colleges & Teaching Universities
  • High Schools
  • Resources for Students

Education Initiatives

  • Next-Gen EdTech
  • Computer-Based Math

More Solutions for Education

  • Contact Us
Learning & Support

Get Started

  • Wolfram Language Introduction
  • Fast Intro for Programmers
  • Fast Intro for Math Students
  • Wolfram Language Documentation

More Learning

  • Highlighted Core Areas
  • Demonstrations
  • YouTube
  • Daily Study Groups
  • Wolfram Schools and Programs
  • Books

Grow Your Skills

  • Wolfram U

    Courses in computing, science, life and more

  • Community

    Learn, solve problems and share ideas.

  • Blog

    News, views and insights from Wolfram

  • Resources for

    Software Developers

Tech Support

  • Contact Us
  • Support FAQs
  • Support FAQs
  • Contact Us
Company
  • About Wolfram
  • Career Center
  • All Sites & Resources
  • Connect & Follow
  • Contact Us

Work with Us

  • Student Ambassador Initiative
  • Wolfram for Startups
  • Student Opportunities
  • Jobs Using Wolfram Language

Educational Programs for Adults

  • Summer School
  • Winter School

Educational Programs for Youth

  • Middle School Camp
  • High School Research Program
  • Computational Adventures

Read

  • Stephen Wolfram's Writings
  • Wolfram Blog
  • Wolfram Tech | Books
  • Wolfram Media
  • Complex Systems

Educational Resources

  • Wolfram MathWorld
  • Wolfram in STEM
  • Wolfram Challenges
  • Wolfram Problem Generator

Wolfram Initiatives

  • Wolfram Science
  • Wolfram Foundation
  • History of Mathematics Project

Events

  • Stephen Wolfram Livestreams
  • Online & In-Person Events
  • Contact Us
  • Connect & Follow
For AIs
  • Your Account
  • User Portal
  • Wolfram Cloud
  • Products
    • Wolfram|One
    • Mathematica
    • System Modeler
    • Compute ServicesUse with Mathematica and Wolfram|One
    • AI AccessUse with Mathematica and Wolfram|One
    • Finance Platform
    • Wolfram|Alpha Notebook Edition
    • Application Server
    • Enterprise Private Cloud
    • Wolfram Engine
    • Wolfram Player
    • Wolfram Cloud App
    • Wolfram Player App

    More mobile apps

    • Wolfram|Alpha
      • Wolfram|Alpha Website
      • Wolfram|Alpha APIs
    • AI Products
      • Wolfram AI Ecosystem
      • Wolfram Foundation Tool
      • Wolfram Cloud MCP
      • Wolfram Local MCP
      • Agent One API
      • CAG Component APIs
    • Core Technologies
      • Wolfram Language
      • Computable Data
      • Wolfram Notebooks
      • Linguistic Understanding
    • Additional Deployment Options
      • Wolfram Cloud
      • Wolfram Web Engine
      • wolframscript
      • WSTPServer
    • Group & Organizational Licensing
    • All Products
  • Consulting & Solutions
    • Wolfram Consulting

    Data Science, Finance & Business

    • Artificial Intelligence
    • Data Science
    • Healthcare
    • Real Estate

    Engineering

    • Civil Engineering
    • Automotive Engineering
    • Sustainable Energy

    Science & Technology

    • AgTech
    • Biosciences
    • Environmental Science
    • Food Science
    • Quantum Computation
    • Social and Behavioral Sciences

    More Wolfram Solutions

    Technology for Education

    • Research Universities
    • Colleges & Teaching Universities
    • High Schools
    • Resources for Students

    Education Initiatives

    • Next-Gen EdTech
    • Computer-Based Math

    More Solutions for Education

    • Contact Us
  • Learning & Support

    Get Started

    • Wolfram Language Introduction
    • Fast Intro for Programmers
    • Fast Intro for Math Students
    • Wolfram Language Documentation

    Grow Your Skills

    • Wolfram U

      Courses in computing, science, life and more

    • Community

      Learn, solve problems and share ideas.

    • Blog

      News, views and insights from Wolfram

    • Resources for

      Software Developers
    • Tech Support
      • Contact Us
      • Support FAQs
    • More Learning
      • Highlighted Core Areas
      • Demonstrations
      • YouTube
      • Daily Study Groups
      • Wolfram Schools and Programs
      • Books
    • Support FAQs
    • Contact Us
  • Company
    • About Wolfram
    • Career Center
    • All Sites & Resources
    • Connect & Follow
    • Contact Us

    Work with Us

    • Student Ambassador Initiative
    • Wolfram for Startups
    • Student Opportunities
    • Jobs Using Wolfram Language

    Educational Programs for Adults

    • Summer School
    • Winter School

    Educational Programs for Youth

    • Middle School Camp
    • High School Research Program
    • Computational Adventures

    Read

    • Stephen Wolfram's Writings
    • Wolfram Blog
    • Wolfram Tech | Books
    • Wolfram Media
    • Complex Systems
    • Educational Resources
      • Wolfram MathWorld
      • Wolfram in STEM
      • Wolfram Challenges
      • Wolfram Problem Generator
    • Wolfram Initiatives
      • Wolfram Science
      • Wolfram Foundation
      • History of Mathematics Project
    • Events
      • Stephen Wolfram Livestreams
      • Online & In-Person Events
    • Contact Us
    • Connect & Follow
  • For AIs
  • Wolfram Cloud
  • Your Account
  • User Portal
Wolfram Language & System Documentation Center
ByteArray
  • See Also
    • ReadByteArray
    • ImportByteArray
    • BinaryWrite
    • BinarySerialize
    • StringToByteArray
    • ByteArrayToString
    • BaseEncode
    • BaseDecode
    • Normal
    • ByteArrayQ
    • Encrypt
    • List
    • NumericArray

    • Formats
    • Base64
    • WXF
  • Related Guides
    • Binary Data
    • Cryptographic Number Theory
    • Cryptography
    • See Also
      • ReadByteArray
      • ImportByteArray
      • BinaryWrite
      • BinarySerialize
      • StringToByteArray
      • ByteArrayToString
      • BaseEncode
      • BaseDecode
      • Normal
      • ByteArrayQ
      • Encrypt
      • List
      • NumericArray

      • Formats
      • Base64
      • WXF
    • Related Guides
      • Binary Data
      • Cryptographic Number Theory
      • Cryptography

ByteArray[{b1,b2,…}]

constructs a ByteArray object containing the byte values bi.

ByteArray["string"]

constructs a ByteArray object by extracting byte values from a Base64-encoded string.

Details
Details and Options Details and Options
Examples  
Basic Examples  
Scope  
Properties & Relations  
See Also
Related Guides
History
Cite this Page
BUILT-IN SYMBOL
  • See Also
    • ReadByteArray
    • ImportByteArray
    • BinaryWrite
    • BinarySerialize
    • StringToByteArray
    • ByteArrayToString
    • BaseEncode
    • BaseDecode
    • Normal
    • ByteArrayQ
    • Encrypt
    • List
    • NumericArray

    • Formats
    • Base64
    • WXF
  • Related Guides
    • Binary Data
    • Cryptographic Number Theory
    • Cryptography
    • See Also
      • ReadByteArray
      • ImportByteArray
      • BinaryWrite
      • BinarySerialize
      • StringToByteArray
      • ByteArrayToString
      • BaseEncode
      • BaseDecode
      • Normal
      • ByteArrayQ
      • Encrypt
      • List
      • NumericArray

      • Formats
      • Base64
      • WXF
    • Related Guides
      • Binary Data
      • Cryptographic Number Theory
      • Cryptography

ByteArray

ByteArray[{b1,b2,…}]

constructs a ByteArray object containing the byte values bi.

ByteArray["string"]

constructs a ByteArray object by extracting byte values from a Base64-encoded string.

Details

  • ByteArray stores data in a memory-efficient way, with the total number of bytes used being close to the length of the array.
  • When displayed in InputForm, a ByteArray object displays as ByteArray["string"], where "string" encodes the bytes in Base64 encoding.
  • In ByteArray[{b1,b2,…}], all the byte values bi should be integers between 0 and 255.
  • ByteArray[{}] and ByteArray[""] produce empty byte arrays. »
  • StringToByteArray[ByteArray[…]] yields a string by interpreting the contents of a byte array using UTF-8 encoding.
  • ExportByteArray[expr,"fmt"] exports an expression via the export format "fmt", giving the result as a byte array. ImportByteArray can be used to convert a byte array to an expression.
  • Normal[ByteArray[…]] yields the list of byte values in the byte array.
  • Functions such as Length and Equal work with ByteArray objects.
  • Functions such as First, Last, Min, and Max yield integer byte values.
  • Part works on ByteArray objects, yielding an integer byte value when it returns a single element, and a ByteArray object when it returns multiple elements.

Examples

open all close all

Basic Examples  (2)

Create a ByteArray from a list of byte values:

Wolfram Language code: ByteArray[{1, 2, 3, 4, 5, 6, 5, 4, 3, 2, 1}]

Convert back to a list of byte values:

Wolfram Language code: Normal[%]

Create a ByteArray from a Base64-encoded string:

Wolfram Language code: ByteArray["AQIDBAUGBwg="]

Convert to a list of byte values:

Wolfram Language code: Normal[%]

ByteArray uses Base64 in InputForm:

Wolfram Language code: InputForm[ByteArray[%]]

Scope  (6)

Get the length of a ByteArray:

Wolfram Language code: Length[ByteArray[Range[32]]]

Extract parts of a ByteArray:

Wolfram Language code: b = ByteArray[Range[32]]
Wolfram Language code: First[b]
Wolfram Language code: Last[b]

Extract a sequence of bytes:

Wolfram Language code: b[[5 ;; 10]]

Convert to an ordinary array:

Wolfram Language code: Normal[ByteArray["AQIDBAUGBwgJCgsMDQ4PEBESExQVFhcYGRobHB0eHyA="]]

Reverse a byte array:

Wolfram Language code: Reverse@ByteArray[Range[5]]
Wolfram Language code: Normal[%]

Read in a "WXF" file as a ByteArray:

Wolfram Language code: ReadByteArray["ExampleData/atoms.wxf"]

Read it in 30 bytes at a time:

Wolfram Language code: ReadByteArray["ExampleData/atoms.wxf", 30]
Wolfram Language code: ReadByteArray["ExampleData/atoms.wxf", 30]

Close the incrementally read file:

Wolfram Language code: Close["ExampleData/atoms.wxf"]

Export an image as a ByteArray:

Wolfram Language code: ExportByteArray[[image], "PNG"]

Interpret a ByteArray as a PNG image:

Wolfram Language code: ImportByteArray[ByteArray["iVBORw0KGgoAAAANSUhEUgAAADIAAAAwCAYAAABT9ym6AAAAhXpUWHRSYXcgcHJvZmlsZSB0eXBlIGV4aWYAAHja\ VYvBDcMwDAP/mqIjyLJM2uMYiQNkg45fuu0n9yApgbT1vi97felp2dgxABc5csRU6P6juNciDXn+X9MfZGWgoRhTluEkhnJXkqK\ FN+LCAahYcIbnIV8gNQN3o86928QyPusLVffpbh/5eCey7 ... R5YozihqSbGIR7/X0EpFk02b4IBbJZGKOEQBJNrFIIc8ZRQ1JNrFIucQZRQ1JNrFIrcoZRQ1JNs1blFyWqGm\ yhwpM05ROJ+XL7+MDV5zw+GXS/8UqlSJqtzh+13C0W24mGX7vwfoMHwA9xkE/aDGg89BiZJqEDNsQ20OLbQUPLTZ6vtFj6+230I\ Vshgq737AkuT0dqUiSaD58+IP8i1waX/JZRTgD/moxAAAAAElFTkSuQmCC"], "PNG"]

Properties & Relations  (6)

ByteArray uses Base64 encoding of its data in InputForm:

Wolfram Language code: InputForm[ByteArray[{1, 2, 3}]]

This string can be generated using BaseEncode:

Wolfram Language code: BaseEncode[ByteArray[{1, 2, 3}]]

Convert a byte array to an ordinary, one-dimensional list using Normal:

Wolfram Language code: ByteArray[{1, 2, 3}]
Wolfram Language code: Normal[%]

Compute the length of a byte array:

Wolfram Language code: ByteArray[{1, 2, 3}]
Wolfram Language code: Length[%]

Create empty byte arrays:

Wolfram Language code: {ByteArray[{}], ByteArray[""]}

Convert a ByteArray to a string using ByteArrayToString:

Wolfram Language code: ByteArrayToString[ByteArray["YcOhzrE="]]

Convert back to a ByteArray using StringToByteArray:

Wolfram Language code: StringToByteArray["aáα"]

BinarySerialize converts expressions to a sequence of bytes returned as a ByteArray:

Wolfram Language code: BinarySerialize[{1, Plot, "hello", Hold[Now]}]

It can be reversed using BinaryDeserialize:

Wolfram Language code: BinaryDeserialize[ByteArray["ODpmBHMETGlzdEMBcwRQbG90UwVoZWxsb2YBcwRIb2xkcwNOb3c="]]

See Also

ReadByteArray  ImportByteArray  BinaryWrite  BinarySerialize  StringToByteArray  ByteArrayToString  BaseEncode  BaseDecode  Normal  ByteArrayQ  Encrypt  List  NumericArray

Formats: Base64  WXF

Function Repository: ByteArrayToBitList  BitListToByteArray

Related Guides

    ▪
  • Binary Data
  • ▪
  • Cryptographic Number Theory
  • ▪
  • Cryptography

History

Introduced in 2015 (10.1) | Updated in 2023 (13.3)

Wolfram Research (2015), ByteArray, Wolfram Language function, https://reference.wolfram.com/language/ref/ByteArray.html (updated 2023).

Text

Wolfram Research (2015), ByteArray, Wolfram Language function, https://reference.wolfram.com/language/ref/ByteArray.html (updated 2023).

CMS

Wolfram Language. 2015. "ByteArray." Wolfram Language & System Documentation Center. Wolfram Research. Last Modified 2023. https://reference.wolfram.com/language/ref/ByteArray.html.

APA

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

BibTeX

@misc{reference.wolfram_2026_bytearray, author="Wolfram Research", title="{ByteArray}", year="2023", howpublished="\url{https://reference.wolfram.com/language/ref/ByteArray.html}", note=[Accessed: 01-September-2026]}

BibLaTeX

@online{reference.wolfram_2026_bytearray, organization={Wolfram Research}, title={ByteArray}, year={2023}, url={https://reference.wolfram.com/language/ref/ByteArray.html}, note=[Accessed: 01-September-2026]}

Top
Introduction for Programmers
Introductory Book
Wolfram Function Repository | Wolfram Data Repository | Wolfram Data Drop | Wolfram Language Products
Top
  • Products
  • Wolfram|One
  • Mathematica
  • AI Access
  • Compute Services
  • System Modeler

  • Wolfram|Alpha Notebook Edition
  • Wolfram|Alpha Pro
  • Mobile Apps

  • Wolfram Engine
  • Wolfram Player

  • Volume & Site Licensing
  • Server Deployment Options
  • Consulting
  • Wolfram Consulting
  • Repositories
  • Data Repository
  • Function Repository
  • Community Paclet Repository
  • Neural Net Repository
  • Prompt Repository

  • Wolfram Language Example Repository
  • Notebook Archive
  • Wolfram GitHub
  • Learning
  • Wolfram U
  • Wolfram Language Documentation
  • Webinars & Training
  • Educational Programs

  • Wolfram Language Introduction
  • Fast Introduction for Programmers
  • Fast Introduction for Math Students
  • Books

  • Wolfram Community
  • Wolfram Blog
  • Public Resources
  • Wolfram|Alpha
  • Wolfram Problem Generator
  • Wolfram Challenges

  • Computer-Based Math
  • Computational Thinking
  • Computational Adventures

  • Demonstrations Project
  • Wolfram Data Drop
  • MathWorld
  • Wolfram Science
  • Wolfram Media Publishing
  • Customer Resources
  • Store
  • Product Downloads
  • User Portal
  • Your Account
  • Organization Access

  • Support FAQ
  • Contact Support
  • Company
  • About Wolfram
  • Careers
  • Contact
  • Events
Wolfram Community Wolfram Blog
Legal & Privacy Policy
WolframAlpha.com | WolframCloud.com
© 2026 Wolfram
© 2026 Wolfram | Legal & Privacy Policy |
English