Formula - base64decode
Section titled “ Formula - base64decode”The base64decode Formula function decodes base64 text and returns the original text, read with UTF-8 or with the source encoding you name.

Animated walkthrough: a Logic App request carries the Order Entry XML of the Order-to-Cash demo as base64 in $content; base64decode(jsonPath('$content', body)) returns the decoded XML.
Syntax
Section titled “ Syntax”base64decode(content [, 'source encoding'])Parameters
Section titled “Parameters”| Parameter | Required | Description |
|---|---|---|
content |
Yes | The base64 text to decode: body, context, or the result of another function, such as jsonPath. |
'source encoding' |
No | The character encoding of the decoded bytes, such as 'UTF-8' or 'iso-8859-1'. Use the encoding the sender used before it encoded the text. Without it, the bytes are read as UTF-8. |
Returns
Section titled “Returns”The decoded text. When the content holds several values, for example from jsonPath, each value is decoded and returned as its own Search Field value. When the content has no value, such as a missing context key, nothing is returned. Content that isn't base64 returns no value either, and the test bench shows the .NET message The input is not a valid Base-64 string as it contains a non-base 64 character, ….
Examples
Section titled “ Examples”Example 1: Decode a base64 message body
Section titled “Example 1: Decode a base64 message body”bm9kaW5pdGU=Formula
Section titled “Formula”base64decode(body)Result
Section titled “Result”nodinite
The base64 body decodes to nodinite with the default UTF-8 encoding.
Example 2: Decode UTF-8 text with a special character
Section titled “Example 2: Decode UTF-8 text with a special character”U2tlbGxlZnRlw6U=Formula
Section titled “Formula”base64decode(body, 'UTF-8')Result
Section titled “Result”Skellefteå
The two UTF-8 bytes for å decode correctly because the source encoding matches.
Example 3: Decode ISO-8859-1 text
Section titled “Example 3: Decode ISO-8859-1 text”The same word, encoded from ISO-8859-1 bytes, is a different base64 string. Name the encoding to read the bytes correctly.
U2tlbGxlZnRl5Q==Formula
Section titled “Formula”base64decode(body, 'iso-8859-1')Result
Section titled “Result”Skellefteå
In ISO-8859-1, å is the single byte E5, so the base64 text differs from Example 2 but decodes to the same word.
Example 4: Decode a context property
Section titled “Example 4: Decode a context property”| Key | Value |
|---|---|
id |
bm9kaW5pdGU= |
Formula
Section titled “Formula”base64decode(context('id'))Result
Section titled “Result”nodinite
The value of the context property id is decoded; the message body isn't used.
Example 5: Decode several values from a JSON body
Section titled “Example 5: Decode several values from a JSON body”[ { "name": "YXdlc29tZQ==" }, { "name": "ZnVuY3Rpb24=" } ]Formula
Section titled “Formula”base64decode(jsonPath('$..name',body))Result
Section titled “Result”awesomefunction
jsonPath returns two base64 values, and base64decode decodes each one: two unique matches.
- The source encoding must match the bytes inside the base64 text. Reading ISO-8859-1 bytes as UTF-8 turns characters such as
åinto replacement characters. - When every message of a Message Type is logged as base64, you can set its encoding to a Base64 Decode into … option instead. The Logging Service then decodes the body before any Search Field Expression runs, so plain body is already text; see Base64 Decode into an encoding.
- Encoding names follow .NET; see the List of encodings.