Back to KB
Difficulty
Intermediate
Read Time
7 min

n8n HTML Extract Node: Scrape and Parse HTML from Any Web Page [Free Workflow JSON]

By Codcompass Team··7 min read

If you've ever needed to pull a price, a headline, a table of links, or any other piece of data from a web page inside an n8n workflow, the HTML Extract node is the tool designed for exactly that job.

This guide covers every option the HTML Extract node supports, the CSS selector syntax you need to know, and three real-world workflow patterns — with free workflow JSON you can import today.


What the n8n HTML Extract Node Does

The HTML Extract node takes an HTML string and extracts data from it using CSS selectors. You point it at the HTML source (from an HTTP Request node, a webhook, or any string expression), define what you want with a selector, and it returns the matched content as structured n8n items.

Common use cases:

  • Scraping product prices or availability from e-commerce pages
  • Extracting article headlines or metadata from news or blog pages
  • Parsing HTML emails for structured data
  • Pulling links, images, or table data from any webpage
  • Monitoring pages for content changes

Node Parameters

Parameter

What it does

Source Data

Where the HTML comes from: Auto-input Data (uses the current item's HTML field) or a custom expression

HTML

The HTML string to parse (available when Source Data = expression)

CSS Selector

Standard CSS selector to target elements

Return Value

What to extract: Inner HTML, Text Content, Attribute, or Value

Attribute

Which attribute to read (when Return Value = Attribute)

Return Array

If enabled, returns all matches as an array instead of just the first


CSS Selector Quick Reference

You don't need to know all of CSS — these patterns cover 95% of HTML extraction use cases:

h1                    → first <h1> element
.price                → elements with class="price"
#main-content         → element with id="main-content"
div.product-card      → <div> elements with class="product-card"
ul.nav > li           → direct <li> children of <ul class="nav">
a[href]               → all <a> elements that have an href attribute
a[href*="amazon"]     → <a> elements with "amazon" in their href
table tr td:nth-child(2) → the second column of every table row
meta[name="description"] → meta description tag
[data-price]          → any element with a data-price attribute

Enter fullscreen mode Exit fullscreen mode


Return Value Options

Text Content — the human-readable text inside the element (strips tags):

<h1>Best Running Shoes 2026</h1>  →  "Best Running Shoes 2026"

Enter fullscreen mode Exit fullscreen mode

Inner HTML — the raw HTML inside the element (preserves child tags):

<p><strong>In stock</strong></p>  →  "<strong>In stock</strong>"

Enter fullscreen mode Exit fullscreen mode

Attribute — a specific HTML attribute value:

selector: a, a

🎉 Mid-Year Sale — Unlock Full Article

Base plan from just $4.99/mo or $49/yr

Sign in to read the full article and unlock all 635+ tutorials.

Sign In / Register — Start Free Trial

7-day free trial · Cancel anytime · 30-day money-back