> For the complete documentation index, see [llms.txt](https://docs.n8n.io/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.n8n.io/integrations/builtin/core-nodes/n8n-nodes-base.html.md).

# HTML

The HTML node provides operations to help you work with HTML in n8n.

{% hint style="info" %}
**HTML Extract node**

The HTML node replaces the HTML Extract node from version 0.213.0 on. If you're using an older version of n8n, you can still view the [HTML Extract node documentation](https://github.com/n8n-io/n8n-docs/blob/86fe33b681621e618e3adcab9a27e8605dbc23ad/docs/integrations/builtin/core-nodes/n8n-nodes-base.htmlextract.md).
{% endhint %}

{% hint style="warning" %}
**Cross-site scripting**

When using the HTML node to generate an HTML template you can introduce [XSS (cross-site scripting)](https://owasp.org/www-community/attacks/xss/). This is a security risk. Be careful with un-trusted inputs.
{% endhint %}

## Operations <a href="#operations" id="operations"></a>

* [**Generate HTML template**](#generate-html-template): Use this operation to create an HTML template. This allows you to take data from your workflow and output it as HTML.
* [**Extract HTML content**](#extract-html-content): Extract contents from an HTML-formatted source. The source can be in JSON or a binary file (`.html`).
* [**Convert to HTML Table**](#convert-to-html-table): Convert content to an HTML table.

The node parameters and options depend on the operation you select. Refer to the sections below for more details on configuring each operation.

## Generate HTML template <a href="#generate-html-template" id="generate-html-template"></a>

Create an HTML template. This allows you to take data from your workflow and output it as HTML.

You can include:

* Standard HTML
* CSS in `<style>` tags.
* JavaScript in `<script>` tags. n8n doesn't execute the JavaScript.
* Expressions, wrapped in `{{}}`.

You can use [Expressions](/build/work-with-data/expressions-versus-data-nodes.md) in the template, including n8n's [Built-in methods and variables](/build/code-in-n8n/use-built-in-shortcuts.md).

## Extract HTML Content <a href="#extract-html-content" id="extract-html-content"></a>

Extract contents from an HTML-formatted source. The source can be in JSON or a binary file (`.html`).

Use these parameters:

### Source Data <a href="#source-data" id="source-data"></a>

Select the source type for your HTML content. Choose between:

* **JSON**: If you select this source data, enter the **JSON Property**: the name of the input containing the HTML you want to extract. The property can contain a string or an array of strings.
* **Binary**: If you select this source data, enter the **Input Binary Field**: the name of the input containing the HTML you want to extract. The property can contain a string or an array of strings.

### Extraction Values <a href="#extraction-values" id="extraction-values"></a>

* **Key**: Enter the key to save the extracted value under.
* **CSS Selector**: Enter the CSS selector to search for.
* **Return Value**: Select the type of data to return. Choose from:
  * **Attribute**: Return an attribute value like `class` from an element.
    * If you select this option, enter the name of the **Attribute** to return the value of.
  * **HTML**: Return the HTML that the element contains.
  * **Text**: Return the text content of the element.
    * If you choose this option, you can also enter a comma-separated list of selectors to skip in the **Skip Selectors**.
  * **Value**: Return the value of an input, select, or text area.
* **Return Array**: Choose whether to return multiple extraction values as an array (turned on) or as a single string (turned off).

### Extract HTML Content options <a href="#extract-html-content-options" id="extract-html-content-options"></a>

You can also configure this operation with these options:

* **Trim Values**: Controls whether to remove all spaces and newlines from the beginning and end of the values (turned on) or leaves them (turned off).
* **Clean Up Text**: Controls whether to remove leading whitespaces, trailing whitespaces, and line breaks (newlines) and condense multiple consecutive whitespaces into a single space (turned on) or to leave them as-is (turned off).

## Convert to HTML Table <a href="#convert-to-html-table" id="convert-to-html-table"></a>

This operation expects data from another node. It has no parameters. It includes these options:

* **Capitalize Headers**: Controls whether to capitalize the table's headers (turned on) or not (turned off).
* **Custom Styling**: Controls whether to use custom styling (turned on) or not (turned off).
* **Caption**: Enter a caption to add to the table.
* **Table Attributes**: Enter any attributes to apply to the `<table>`, such as style attributes.
* **Header Attributes**: Enter any attributes to apply to the table's headers `<th>`.
* **Row Attributes**: Enter any attributes to apply to the table's rows `<tr>`.
* **Cell Attributes**: Enter any attributes to apply to the table's cells `<td>`.

## Templates and examples <a href="#templates-and-examples" id="templates-and-examples"></a>

[Browse HTML integration templates](https://n8n.io/integrations/html) or [search all templates](https://n8n.io/workflows/)
