How to Convert HTML to Text in Power Automate [Step-by-Step]

If you’re seeing messy HTML tags showing up in your Power Automate emails, Teams messages, or SharePoint list items — you’re not alone. This is one of the most common frustrations when working with flows that pull content from SharePoint Rich Text columns, Outlook email bodies, or Dataverse records.

The good news: Power Automate has a built-in HTML to Text action that strips those tags out cleanly. In this tutorial, I’ll walk you through exactly how to use it, show you how to fix the line break issue that catches most people off guard, and cover some real-world scenarios where this comes up.

What You’ll Learn in This Tutorial

  • How to convert an HTML file to plain text using Power Automate and send it via email
  • How to remove extra line breaks after converting HTML to text
  • How to strip HTML tags from a SharePoint Rich Text column
  • Common errors and how to fix them
  • When to use the HTML to Text action vs. alternative methods

Why Does HTML Show Up in the First Place?

Before jumping into the steps, it helps to understand why this happens.

When you store content in a SharePoint Rich Text column, it’s saved behind the scenes as HTML — things like <p>, <b>, <br>, and <div> tags. The same goes for email bodies in Outlook and description fields in Dataverse. When your flow grabs that content and drops it into a Teams message, an email body, or a log file, those raw HTML tags come along for the ride.

That’s where the HTML to Text action saves you.

Convert HTML to Text in Power Automate

Let’s see 5 different examples of using HTML to Text in Power Automate.

Example 1: Convert an HTML File to Plain Text and Email It in Power Automate

This is the most straightforward use case — you have an HTML file and want to convert its content to plain text, then send it via email.

Step 1: Create an Instant Cloud Flow

  1. Log in to Power Automate
  2. Click + Create in the left navigation
  3. Select Instant cloud flow
  4. Give your flow a name (e.g., Convert HTML to Text)
  5. Select Manually trigger a flow as the trigger
  6. Click Create
Convert HTML Description into Plain Text of Email in Power Automate

Once the flow canvas opens, click on the Manually trigger a flow action to expand it.

Step 2: Add a File Input

Inside the trigger:

  • Click Add an input
  • Select Text
HTML to Text Conversion Power Automate

This lets you provide an HTML text when you run the flow manually.

Step 3: Compose the Input Text

  • Click + New step
  • Search for and select Compose
  • In the Inputs field, click inside it, then select Text from the dynamic content panel

This step captures the raw file content so you can pass it to the HTML to Text action.

Step 4: Convert HTML to Text

  • Click + New step
  • Search for Html to text and select the action
  • In the Content field, select Outputs from the Compose step (from dynamic content)
How to Convert HTML Strings to Text in Power Automate

That’s the core conversion done. The action will strip all HTML tags and return clean plain text.

Step 5: Send the Result via Email

  • Click + New step
  • Search for Send an email (V2) and add it
  • Fill in the following fields:
    • To: Your recipient’s email address
    • Subject: Something like Converted Text File
    • Body: Add a note like “See attached plain text file”
  • Click Show advanced options
    • Attachments Name: Give it a name like output.txt
    • Attachments Content: Select the Outputs from the HTML to Text action
Convert HTML to Text in Power Automate(Microsoft Flow)

Step 6: Test the Flow

  • Save the flow
  • Click the Test icon (top right) → select Manually → click Test
  • Click Import and choose your HTML file
  • Click Run flow
Convert an HTML File to Plain Text and Email It in Power Automate

Check your inbox — you should receive an email with the plain text version of your HTML file as an attachment. No tags, no markup, just clean, readable text.

Method 2: Remove Line Breaks After Converting HTML to Text in Power Automate

Here’s the issue that trips most people up. When your HTML contains <br> tags or line breaks, the HTML to Text action preserves those as newline characters in the output. So instead of a clean paragraph, you end up with every sentence on its own line.

The fix is to use a replace() expression to remove those extra line breaks after conversion.

Step 1: Create the Flow

Follow the same steps as above to create a new Instant Cloud Flow with a Manually trigger a flow trigger.

Step 2: Add the HTML Content in a Compose Step

  • Click + New step → add a Compose action
  • In the Inputs field, paste or reference your HTML code

For example, your HTML might look like this:

<p>Hello,<br>This is a test.<br>Thank you.</p>
Power Automate HTML to text remove line breaks

Step 3: Capture a Line Break Character

This is the trick that makes the replacement work properly.

  • Click + New step → add another Compose action
  • In the Inputs field, press Enter once to insert an actual newline character
Power Automate Handling New Lines \n with Replace

Name this action something like Compose Line break — you’ll reference it in the next step. This gives Power Automate the exact character to search for and replace.

Step 4: Convert HTML to Text

  • Click + New step → add the Html to text action
  • In Content, select the Outputs from your first Compose action (the HTML content)
Removal of line breaks from the HTML - Power Automate

Step 5: Replace the Line Breaks

  • Click + New step → add another Compose action
  • In the Inputs field, switch to Expression mode and enter:
replace(outputs('Html_to_text')?['body'], outputs('Compose_Line_break'), '')
How to replace new line &#039;n&#039; in a Power Automate expression

Note: Make sure the action names in the expression match the actual names of your steps. If you named your HTML to Text step differently, update ‘Html_to_text’ accordingly.

Step 6: Send the Clean Output via Email

  • Add a Send an email (V2) action
  • In the Body field, select the Outputs from the last Compose step
Power Automate HTML to Plain Text Conversion Issue

Step 7: Test It

Run the flow manually and check the email. Your converted text should now appear as a single clean block without those unwanted line breaks.

Remove Line Breaks After Converting HTML to Text in Power Automate

Method 3: Strip HTML from a SharePoint Rich Text Column in Power Automate

This is the use case I see the most in real-world projects. You have a SharePoint list with a Multiple lines of text (Rich Text) column, and when your flow reads it, the content comes back packed with HTML tags like <div><p><b>, and <span>.

Power Automate Strip HTML from a SharePoint Rich Text Column

Here’s how to clean it up in seconds:

  1. Set up your flow trigger (e.g., When an item is created or modified in SharePoint)
  2. Add an Html to text action
  3. In the Content field, select the Rich Text column from the dynamic content
Strip HTML from a SharePoint Rich Text Column in Power Automate

That’s it. The output of the HTML to Text action is now clean text you can use in a Teams notification, an email body, or any other step.

Practical example: I’ve used this in flows that log SharePoint task descriptions into a Teams channel. Without the HTML to Text step, the Teams message looks like <div class=”ExternalClass”>Task details here</div>. With it, you just get the task details here.

Method 4: Clean Up HTML from an Outlook Email Body in Power Automate

When a Power Automate flow reads an incoming email, the Body property often returns HTML — even if the original email looked like plain text. This is especially common with automated emails from systems like ServiceNow, Salesforce, or Dynamics.

To clean it:

  1. Use the When a new email arrives (V3) trigger in Outlook
  2. Add an Html to text action
  3. Set Content to the Body dynamic value from the trigger
Clean Up HTML from an Outlook Email Body in Power Automate

You can then use the clean output to write to an Excel row, log to a SharePoint list, or forward the content in a Teams message — without the HTML clutter.

Method 5: Extract Plain Text from a Dataverse Email Record in Power Automate

If you’re working with Dataverse and pulling email description fields, you’ll face the same HTML problem. The description field in an email record stores content as HTML markup.

  1. Use the When a row is added, modified or deleted trigger for the Email Messages table in Dataverse
  2. Add an Html to text action
  3. Set Content to the Description column from the trigger output
Extract Plain Text from a Dataverse Email Record in Power Automate

This is super useful for customer service flows where you need to parse email body content, extract keywords, or log clean summaries into other systems.

Known Limitations of the HTML to Text Action

Before you build your flow, here are a few things worth knowing upfront — so you don’t get caught off guard later:

  • Max file size is 5 MB. If your HTML content is larger than that, the action will fail. For large files, consider chunking the content or using an Azure Function.
  • DOM tree depth limit is 250 levels. Complex, deeply nested HTML may not convert completely. If you’re getting truncated output, this could be why.
  • Line length is capped at 80 characters. The action inserts line breaks after every 80 characters in the output. That’s by design — use the replace() method above to remove them if needed.
  • Links are converted to Markdown-style references. A hyperlink like <a href="https://example.com">Click here</a> becomes [Click here][1] in the output. If you need the URL removed entirely, you’ll need a replace() expression to clean it up.
  • Images are stripped. The action removes image tags entirely, including alt text. If the alt text matters, extract it separately using an XML/XPath expression before running the HTML to Text step.

Common Errors and How to Fix Them

Error: “Invalid template language expression”

This usually happens when you’re passing raw HTML to an XML-based expression like xpath() instead of using the HTML to Text action. The XML function requires well-formed XML, but HTML is not always valid XML. Stick to the Html to text action for HTML content, not the XML function.

Error: Blank Output from HTML to Text

If the action runs successfully but returns empty text, the most likely cause is that your Content field is pulling a null value. Add a Condition step before the HTML to Text action to check that the column or variable is not empty. Use:

empty(triggerOutputs()?['body/fieldname'])

If it returns true, skip the conversion step.

Inconsistent Line Breaks

If your output looks fine on some runs but has unexpected \n characters on others, it’s usually because the source HTML varies — sometimes it has <br> tags, sometimes it uses \n directly. The safest fix is to run two replace() steps: one for the newline character (using the Compose trick above) and one for \n using an expression like:

replace(outputs('Html_to_text')?['body'], '\n', '')

When to Use HTML to Text vs. Other Methods

Not every situation needs the same solution. Here’s a quick guide:

ScenarioBest Approach
HTML file → plain text outputHTML to Text action
SharePoint Rich Text columnHTML to Text action
Outlook email body → plain textHTML to Text action
Dataverse email description fieldHTML to Text action
Large HTML file over 5MBAzure Function + HTTP action
Need to extract only specific tagsXML + XPath expression
Need to preserve links in outputHTML to Text + post-processing with replace()
Complex nested HTML with imagesCustom Azure Function

Wrapping Up

The HTML to Text action in Power Automate is simple but genuinely useful once you know where it fits. The two things most tutorials skip — the line break fix and the known limitations — are exactly what will save you debugging time when something doesn’t look right.

If you run into edge cases with large HTML files or need to extract specific elements rather than all text, combining the HTML to Text action with replace() expressions or XML functions gives you a lot of flexibility.

You may also like:

Frequently Asked Questions

Does the HTML to Text action support tables?

Partially. Table tags are stripped, but the cell content is preserved as plain text. The rows and columns won’t be formatted — the text will just run together. If table structure matters, consider extracting data with an XPath expression instead.

Which connector does the HTML to Text action belong to?

It’s part of the Content Conversion connector in Power Automate. You don’t need a premium license — it’s available in all plans.

Can I use HTML to Text with Power Apps?

Not directly from Power Apps. You’d trigger a Power Automate flow from Power Apps, run the conversion in the flow, and return the result back to the app.

Does it work with SharePoint Online and SharePoint on-premises?

Yes for SharePoint Online. For on-premises, it depends on your gateway configuration, but the conversion action itself works the same way once the content is inside the flow.

What happens if my HTML has special characters like &amp; or &nbsp;?

The action handles most standard HTML entities, but &nbsp; (non-breaking space) can sometimes appear as a blank character in the output rather than a regular space. Add a replace() step to catch it: replace(body, uriComponent('%C2%A0'), ' ').

>

Build a High-Performance Project Management Site in SharePoint Online

User registration Power Apps canvas app

DOWNLOAD USER REGISTRATION POWER APPS CANVAS APP

Download a fully functional Power Apps Canvas App (with Power Automate): User Registration App

Power Platform Tutorial FREE PDF Download

FREE Power Platform Tutorial PDF

Download 135 Pages FREE PDF on Microsoft Power Platform Tutorial. Learn Now…