# HTML to Text

> Strip the markup out of an HTML string and get readable text back.

The **HTML to text** step takes a string full of markup and gives you back the readable text inside it.

> Dock: Data · Convert · Takes: HTML · Returns: text

Most often you need it because an email body, a CRM note or a fetched web page arrived as HTML. The next step wants text a person can read: a Slack message, a spreadsheet cell, a summary.

> **No extra step needed?** You can strip HTML directly inside any field token using [Data Transformation](/build/core-concepts/data-transformation) with `{{ 2.html_body | strip_html }}`. Use this dedicated **HTML to text** step when you want the cleaned text stored as a standalone canvas output for multiple subsequent steps to reuse.

**Keyboard shortcut:** `t+h`

## Setting it up

1. Press `t+h`, or open **Tools → Data → Convert** in the dock and select **HTML to text**.
2. In the **Input** field, pick the HTML from an earlier step.
3. Save the step.

## What it passes on

The converted text is read by step number, like any other step:

```
{{ 3.ret }}
```

Run the step once and read the **Executions** tab to confirm the path before you build against it. That is quicker than reasoning it out, and it settles the question for good.

## What it leaves behind

- **Styles and scripts.** Markup that is not readable text is stripped along with the tags.
- **Entities and odd markup.** Encoded characters are turned back into the characters they stand for, and imperfectly nested tags do not stop the step.
- **Empty input.** An empty or missing input produces an empty string.

The exact output for a given page is worth confirming once in the **Executions** tab rather than predicting it. HTML in the wild varies more than any rule about it does.

> **Links come through as text only.** "Visit this link" survives; the address
> behind it does not. If you need the URLs, pull them out with a [Code
> editor](/build/action-steps/code-execution) step before stripping the tags.

## Examples to copy

### What goes in and what comes out

```html
<h1>Order Confirmation</h1>
<p>Thank you for your order, <strong>Jane</strong>.</p>
<ul>
  <li>Item: Widget Pro</li>
  <li>Quantity: 3</li>
  <li>Total: $89.97</li>
</ul>
<p>
  Visit <a href="https://example.com/track">this link</a> to track your order.
</p>
```

**Out:**

```
Order Confirmation

Thank you for your order, Jane.

- Item: Widget Pro
- Quantity: 3
- Total: $89.97

Visit this link to track your order.
```

The step preserves the structure (paragraphs become line breaks, list items are prefixed with dashes) while removing all HTML markup.

### An email body into Slack

An email trigger gives you the message as HTML. Slack shows the tags rather than
the words unless you convert it first.

**What to do:** add HTML to text after the trigger, set **HTML** to the email's
body field, and put `{{ 3.ret }}` in the Slack step's message — replacing `3`
with this step's own number.

### A page you fetched into an AI step

An [HTTP Request](/build/action-steps/http-request) returns a page as markup, and
an AI step reading it spends most of its budget on tags.

**What to do:** put HTML to text between them, with **HTML** set to
`{{ 3.ret.body }}`, and reference the converted text in the prompt.

## What's Next?

- Break the resulting text into a list with [Split Text](/build/action-steps/split-text).
- Write a custom parser for more complex extraction using [Code editor](/build/action-steps/code-execution).
