How to Convert a Base64 Image to Binary and Save to SharePoint with Power Automate

Do you need to convert a base 64 string to binary in your Power Automate flow?

Converting a Base64 string to an image is required in order to save it to a SharePoint site. This can be especially useful when handling images transferred between systems as these are often in base 64 formats.

This article will show you the process to convert and store images from Base64 strings directly into SharePoint.

Understanding the Basics: Base64 vs Binary

Base64 and binary are two methods of representing data, each with distinct properties and uses.

Binary Data Representation

Binary is the most basic form of data storage and processing format. It’s a system that represents data in two-symbol form: 0 and 1.

These binary digits, or bits, are the smallest unit of data in computing. Binary is used directly by computers because of its efficiency and ease of implementation with digital electronic circuitry using logic gates.

Base64 Data Representation

Base64, on the other hand, is a binary-to-text encoding scheme. It’s primarily used when there’s a need to encode binary data, especially when that data needs to be stored and transferred over media designed to handle text.

Base64 ensures that the data remains intact without modification during transport.

In Base64, the binary data is represented as a string of characters from an available set of 64 different ones (hence the name “Base64”). This set usually includes A-Z, a-z, 0-9, +, / and = for padding.

Key Differences Between Base64 and Binary

  1. Purpose: Binary is used for direct data storage and processing in computers, while Base64 is used to encode this binary data into a format that’s safe for transport and storage in systems designed for text.
  2. Representation: Binary data is represented in bits (0s and 1s), while Base64 data is represented in a set of 64 different characters.
  3. Size: Encoding binary data to Base64 will result in it taking up about 33% more space.
  4. Compatibility: Binary data may not be safe or compatible with all systems, particularly those designed for text. Base64 encoding solves this problem by converting the binary data into a text format.
  5. Use Cases: Binary is used in almost all low-level and high-level computer operations. Base64 is commonly used when there’s a need to encode binary data, particularly when that data is to be sent over a protocol designed to handle text. This encoding helps to ensure that the data remains intact without modification during transport.

📝 Note: Base64 isn’t an encryption or obfuscation method for securing data, but a way to encode binary data for safe transmission or storage.

Base 64 Image Example


As an example, the above text is the base 64 representation of this small image.

  "$content-type": "image/jpeg",
  "$content": "/9j/4AAQSk...FABQB//Z"

Often, when you get base64 image content into Power Automate, it will be in the above format.


This means, if you want to access the base 64 text you will need to use an expression such as the above. Adding ['$content'] will return only this value from the JSON.

Binary Data in SharePoint

SharePoint stores images as binary data, not as Base64.

Images in SharePoint are stored within libraries, which are essentially folders for storing files.

When you upload an image to SharePoint, it’s stored as binary data in a database managed by SharePoint.

It’s important to note that while Base64 can be used to encode images for safe transmission over networks, it’s not typically used for long-term storage because it increases the total size of the file. For efficient storage and retrieval, SharePoint uses binary format to store images.

Converting Base64 String to Binary with the base64ToBinary Function

When working with base64 encoded strings, you may need to convert them into binary data to create an image in SharePoint using Power Automate.

This section will discuss the base64ToBinary function and how to use it for this purpose.

To start, you will need to get an image into your flow. This could be from many different sources, but this example will get an image from the web using an HTTP request.

  1. Add an HTTP action to your flow. Note, this is a premium action and will need a premium license to use.
  2. Select the GET option from the Method dropdown.
  3. Add the URI of your image. In this example the URL is which is a jpeg image hosted on this site.

Now you can use a Compose action to convert the results of the HTPP action from base 64 to binary.

  1. Add the Compose action to your flow and add the above expression.

The results of this expression can then be used directly as the Content in the Create file action to create a new image file in your SharePoint library of choice.

  1. Add the Create file action from the SharePoint connector to your flow.
  2. Select the Site Address of the SharePoint library where you want to save the image.
  3. Select the Folder Path where you want to save the image.
  4. Add a File Name and be sure to include the correct image file extension such as .png or .jpg.
  5. Add the dynamic content from the Compose action where you used the base64ToBinary function to convert the base 64 text to binary.

These steps will allow you to successfully convert a base64 encoded string into an image and save it to SharePoint.


This article showed you how to convert a base64 string to an image and save it to SharePoint.

Using the base64ToBinary function, you can easily convert base64 encoded strings into binary format.

Once the conversion is done, you can use the Create file action to save the binary image data to a SharePoint document library.

Have you tried saving base 64 images to SharePoint before? Let me know in the comments below!

About the Author

John MacDougall

John MacDougall

John is a Microsoft MVP and freelance consultant and trainer specializing in Excel, Power BI, Power Automate, Power Apps and SharePoint. You can find other interesting articles from John on his blog or YouTube channel.

Related Articles



Submit a Comment

Your email address will not be published. Required fields are marked *

Get the Latest Tech Tips

Write For Us

Are you a tech enthusiast with a talent for writing great content? Come write for us!

Follow Us

Follow us on social media to stay up to date with the latest in tech!