Power Automate Base64 being converted to binary

William Ritchie 60 Reputation points
2025-06-19T20:19:37.8366667+00:00

I am confused on how to add an embedded image to my automated email in power automate.

With the following connector, I am using "Attachments Content" to get the original image. When I put this into a 'Compose' action I can see that it is base64 encoded.

Screenshot 2025-06-19 155420

When I try to embed this image in a new email, as shown below:

User's image

I get a string that is no long base64 encoded, it looks like it is binary now:

User's image

Am I doing something wrong? Why is it being converted to binary?

Community Center Not monitored
0 comments No comments
{count} votes

Accepted answer
  1. Saideep Anchuri 9,425 Reputation points Microsoft External Staff Moderator
    2025-06-23T14:49:11.33+00:00

    Hi William Ritchie

    I'm glad that you were able to resolve your issue and thank you for posting your solution so that others experiencing the same thing can easily reference this! Since the Microsoft Q&A community has a policy that "The question author cannot accept their own answer. They can only accept answers by others ", I'll repost your solution in case you'd like to accept the answer.

    Ask: Power Automate Base64 being converted to binary

    Solution: The issue is resolved. Figured it out. Instead of directly using the attachment content, I first used a compose action with the following: base64(base64ToBinary(outputs('youremailattachment'))) not sure why I need to decode and then encode again but it works for me!

    If I missed anything please let me know and I'd be happy to add it to my answer, or feel free to comment below with any additional information.

    If you have any other questions, please let me know. Thank you again for your time and patience throughout this issue.

     

    Please don’t forget to Accept Answer and Yes for "was this answer helpful" wherever the information provided helps you, this can be beneficial to other community members.

    Thank You.


2 additional answers

Sort by: Most helpful
  1. Mark Thwaite 10 Reputation points
    2025-06-19T22:10:05.38+00:00

    Hi William,

    I've experienced this recently - although my source was a SharePoint doc library saved image and not from email attachments, so your experience may vary.

    I've noticed declaring img src straight in the email action and body tends not to work.
    I corrected my issue by the following:

    1. Before the email action, add a Compose action and enter the following as an expression/formula:
      base64(outputs('youremailattachment')) -This declares it as Base64 outside of the email action
    2. Next add a second Compose action, and add your img src code to it (referencing the first compose and not the attachment content):
      <img src="data:image/png;base64,@body('Compose')" />
    3. Finally, add the output of the second compose action to the body of your email action.

    Note to point 2: My code was slightly different and may impact the outcome, so I'll put a sample here:
    <img src="data:image/png;base64,@body('Compose')" alt="Attachment" style="width:300px; height:auto;"/>

    I hope this works for you, best of luck!

    2 people found this answer helpful.

  2. William Ritchie 60 Reputation points
    2025-06-20T15:09:27.1133333+00:00

    Figured it out. Instead of directly using the attachment content, I first used a compose action with the following: base64(base64ToBinary(outputs('youremailattachment'))) not sure why I need to decode and then encode again but it works for me!

    2 people found this answer helpful.

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.