How to Base64 Encode Binary Data in Power Automate

Cloudmersive
4 min readNov 22, 2024

--

If we’re largely working with text-based protocols & systems, binary data just won’t cut it. Thankfully, converting binary data to a Base64 text string solves that problem — albeit at the expense of an increased file size and slightly more processing time.

If we find ourselves dealing with binary data in Power Automate, we can easily convert our binary content to a Base64 string using the Cloudmersive File Processing connector. In fact, we can convert both to AND from Base64 with two different file processing actions.

Base64 Encode Binary Data in Power Automate

In this article, we’ll learn how to Base64 encode a simple binary string in a quick instant cloud flow in Power Automate. We’ll end up with a text string exactly 33% larger than our original binary string (Base64 encodes data at 4/3 the size of the original binary).

We’ll start by locating the Cloudmersive File Processing connector in the Power Automate connector library. To find it, we’ll add a new action in our flow and type “Cloudmersive” into the connector search bar.

We’ll find the File Processing connector by scrolling down our resulting list just a bit. It has a purple logo.

To view the entire actions list, we’ll click on the “See more” option to the right of the connector title.

From there, we’ll select the second action on the list titled Base 64 encode, convert binary or file data to a text string.

After we click on this action, it’ll be time to create our Cloudmersive File Processing connection.

If you’re familiar with using Cloudmersive connectors, you’ll know we simply need to copy an API key from our Cloudmersive account & paste that in the API key field (not shown here) to authorize our connection. If you’re new to using Cloudmersive connectors, you can get a free API key by visiting the Cloudmersive website and creating a free account. With a free account, you’ll be able to make up to 800 API calls per month with zero additional commitments.

Once our connection is created and authorized, we’ll enumerate our advanced parameters (which only includes one input field). In the Request/ContenttoEncode parameter, we’ll enter our binary data. If we’re looking for an easy way to get binary data for testing, we can simply pull up ChatGPT in another tab and ask it for an example binary value.

Once that’s done, we’ll save our flow and run a quick test.

When our flow finishes running, we’ll open our Base 64 encode action and review our output.

As per usual in any Base64 encoding process, our original binary data was divided into 6-bit chunks, with each chunk mapped to a character in the Base64 alphabet (this includes the characters A-Z, a-z, 0–9, +, and /). The “=” signs at the end are used as a form of padding to ensure the data is fully aligned in 24-bit blocks.

We can use this action in Power Automate to make binary data accessible to text-based systems. For example, if we wanted to embed a binary image file directly in an email body, we would need to Base64 encode that binary data first — and we could accomplish that easily with the action demonstrated in this flow.

That’s all there is to it! Now we have a simple and convenient Base64 encoding tool in our Power Automate arsenal.

--

--

Cloudmersive
Cloudmersive

Written by Cloudmersive

There’s an API for that. Cloudmersive is a leader in Highly Scalable Cloud APIs.

No responses yet