Introduction
In Power Automate, we often need to convert data into different formats while working with APIs, URLs, or files. URI and data conversion functions help handle this easily. At first, their names can feel confusing because many of them look similar. But once you understand the basic idea behind them, they are quite simple to use.
In this article, I will explain each function with easy examples.
Prerequisites
Now, we will go through each URI and Data Conversion function one by one. Please follow the steps below and implement them for each function. For every function, create a simple flow, add the action, write the expression, and run it to check the output. This will help you understand how each function works in a practical way.
1. dataUri()
This function converts a given input into a Data URI format. This format includes some metadata along with base64-encoded content.
Syntax
dataUri('text')
Example
dataUri('Hello World')
![1]()
Output:
![2]()
Usage
I usually use this when a system or API expects content in Data URI format instead of plain text. It is helpful when sending file content or embedding data directly in a request.
2. dateUriToBinary()
This function converts a Data URI back into binary format.
Syntax
dataUriToBinary('dataUri')
Example
for dataUri use the output of the above compose action (outputs('Compose_-_dataUri')) to convert it into binary format.
dataUriToBinary(outputs('Compose_-_dataUri'))
![3]()
Output
![4]()
Usage
I use this when I receive content in Data URI format (usually from APIs) and need to convert it back into usable file content-for example, saving it to SharePoint or OneDrive.
3. encodeUriComponent()
This function encodes a string so it can be safely used inside a URL.
Syntax
encodeUriComponent('text')
Example
encodeUriComponent('Hello World')
![5]()
Output
![6]()
Usage
I use this when building dynamic URLs or passing parameters to APIs. It makes sure special characters like spaces or & don’t break the URL.
4. decodeUriComponent()
This function converts an encoded URI string back into a readable format.
Syntax
decodeUriComponent('encodedText')
Example
For encodedText, use the output of the above Compose action (outputs('Compose_-_encodeUriComponent')) to convert it back into a readable string format.
decodeUriComponent(outputs('Compose_-_encodeUriComponent'))
![7]()
Output
![8]()
Usage
It will Helpful when working with API responses or query parameters that come encoded. It makes the data readable again.
5. uriComponent()
This function encodes a string into a URI-safe format, similar to encodeUriComponent().
Syntax
uriComponent('text')
Example
uriComponent('Hello World')
![9]()
Output
![10]()
Usage
I have used this while building URLs dynamically. It works almost the same as encodeUriComponent(), so you can use either depending on your preference.
6. uriComponentToString()
This function converts a URI-encoded value back into a normal string.
Synta
uriComponentToString('encodedText')
Example
For encodedText, use the output of the above Compose action (outputs('Compose_-_uriComponent')) to convert URI-encoded value back into a normal string.
uriComponentToString(outputs('Compose_-_uriComponent'))
![11]()
Output
![12]()
7. uriComponentToBinary()
This function converts a URI component into binary data.
Syntax
uriComponentToBinary('encodedText')
Example:
uriComponentToBinary('Hello%20World')
![13]()
Output
![14]()
Usage
I don’t use this very often, but it comes in handy when working with encoded data that needs to be treated as file content or binary input in downstream actions.
Conclusion
These functions may feel confusing at first because many of them look similar. But once you understand which ones are for encoding, decoding, or handling data, it becomes much easier.
Try using them in real flows and you’ll quickly get comfortable. With a bit of practice, you will know exactly which function to use.