# Web Page to Markdown for LLMs: URLs to Clean Text & Metadata (`tagadanar/web-page-to-markdown`) Actor

Turn web page URLs into clean Markdown, plain text and metadata (title, description, language, headings, links, word count, token estimate) for LLM and RAG use. Optional same-site crawl. robots.txt honoured. $1.00 per 1,000 pages + $0.001/run.

- **URL**: https://apify.com/tagadanar/web-page-to-markdown.md
- **Developed by:** [Tagada Data](https://apify.com/tagadanar) (community)
- **Categories:** AI, Developer tools, Automation
- **Features:** Limited permissions
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $0.70 / 1,000 page converteds

This Actor is paid per event. You are not charged for the Apify platform usage, but only a fixed price for specific events.
Since this Actor supports Apify Store discounts, the price gets lower the higher subscription plan you have.

Learn more: https://docs.apify.com/actors/running/actors-in-store.md#pay-per-event

## What's an Apify Actor?

An Actor is a serverless cloud program that runs on the Apify platform. It has two run modes.
In Batch mode, an Actor accepts a well-defined JSON input, performs an action which can take anything from a few seconds to a few hours,
and optionally produces a well-defined JSON output, datasets with results, or files in key-value store.
In Standby mode, an Actor provides a web server which can be used as a website, API, or an MCP server.

Apify vocabulary and the platform model are defined once, in the agent quickstart at https://apify.com/agents.md.

## How to integrate an Actor?

If asked about integration, you help developers integrate Actors into their projects.
You adapt to their stack and deliver integrations that are safe, well-documented, and production-ready.

Do not guess an integration path. Every one of them is in the agent quickstart at https://apify.com/agents.md: the Apify MCP server, Agent Skills with the Apify CLI, the JavaScript and Python clients, the REST API, and the account-free path for an agent with no human to sign in. It also carries the rule on stating cost before the first paid run.

For examples already wired to this Actor's own input schema, see the [API](#api) section below.

Each client library has reference documentation the quickstart does not restate: [JavaScript/TypeScript](https://docs.apify.com/api/client/js/docs.md) (`npm install apify-client`) and [Python](https://docs.apify.com/api/client/python/docs.md) (`pip install apify-client`).

# README

## Web Page to Markdown for LLMs: URLs to Clean Text & Metadata

Paste a list of web page URLs and get **one row per page with clean Markdown, plain text and the page's metadata**, ready to feed a language model, a RAG index or a vector database. Menus, headers, footers, sidebars and cookie banners are dropped; headings, lists, tables, code blocks and links are kept. Each row also carries the title, description, canonical URL, language, author, publish date, the page's headings and links, a word count and a token estimate. Optionally follow same-site links a few levels deep to convert a whole docs section or blog.

**$1.00 per 1,000 pages on Free ($0.70 on Gold), plus $0.001 per run. Platform usage is included.** Pages over 1 MB of HTML add $0.001 per extra started MB (most pages are far below). Pages that could not be converted are free. No API key, no login, no proxy needed.

### What you get

One flat row per page.

| Field | What it is |
| --- | --- |
| `url` | The page URL you gave (or the crawl found) |
| `finalUrl` | Where the page ended after redirects |
| `status` | `OK` for a converted page; otherwise why it was not converted (see below) |
| `markdown` | The page as clean Markdown: headings, paragraphs, lists, GitHub-style tables, fenced code, links |
| `text` | The same content as plain text, no Markdown syntax |
| `title` | The page's `<title>` |
| `headline` | The page's main heading (its `<h1>`), else the title |
| `description` | The meta description |
| `canonicalUrl` | The canonical URL the page declares |
| `lang` | The page's language code (`en`, `fr`, `ja`...) |
| `author`, `siteName`, `publishedTime` | From the page's meta tags, when present |
| `imageUrl` | The page's preview image (og:image) |
| `metaRobots` | The page's robots meta tag, if any (`noindex`, `nofollow`...) |
| `headings` | The headings of the converted content: `[{level, text}]` |
| `links` | The links inside the converted content: `[{url, text}]`, up to 300 |
| `linkCount` | How many distinct links the converted content holds |
| `wordCount`, `charCount` | Size of the plain text (CJK characters count as one word each) |
| `tokenEstimate` | About how many LLM tokens the Markdown is (about 4 characters per token, 1 per CJK character; an estimate, not a tokenizer count) |
| `extraction` | `main-content`, `full-page`, `full-page-fallback` (no clear main block was found, so the page minus its menus and footers was kept) or `plain-text` |
| `httpStatus`, `contentType`, `htmlBytes`, `truncated` | The HTTP answer, its type, the HTML size, and `true` if the page was over 8 MB and cut |
| `startUrl`, `depth` | For crawls: the start URL that led here and how many links away it is |
| `message` | Why a page was not converted, or a note |
| `fetchedAt` | When the page was fetched (ISO 8601) |

### Who uses it

- **AI and RAG builders** who need a list of pages (docs, help centers, blogs, Wikipedia) as clean Markdown chunks with titles and headings, without writing a scraper.
- **Agents and automations** (n8n, Make, Zapier, LangChain, LlamaIndex) that need "read this URL" as one cheap API call with a predictable row.
- **Content and SEO teams** who want the text, headings, word count and links of many pages in one table.

### Examples

Prefill (the canary run): two pages, main content only.

```json
{"startUrls":["https://en.wikipedia.org/wiki/Markdown","https://docs.python.org/3/tutorial/introduction.html"]}
```

Convert a documentation section: the start page plus the pages it links to under the same folder, up to 50 pages.

```json
{"startUrls":["https://docs.python.org/3/tutorial/index.html"],"maxCrawlDepth":1,"maxPagesPerStartUrl":50}
```

Whole page instead of the main content, with images kept in the Markdown:

```json
{"startUrls":["https://www.gov.uk/browse/benefits"],"extractMainContent":false,"includeImages":true}
```

### How it reads pages

- **Plain HTTP fetch, no JavaScript.** The actor reads the HTML the site serves. Pages that build their text in the browser (single-page apps that serve an empty shell) come back with status `JS_SHELL` and are **not charged**. Most articles, docs, blogs, news, Wikipedia and government pages are served as HTML and convert fine.
- **robots.txt is honoured for every page.** Each site's robots.txt is read once per run (the `*` group, or a group addressed to `WebPageToMarkdown`). A disallowed page is reported as `ROBOTS_DISALLOWED`; a site whose robots.txt says `Content-Signal: ai-input=no` is reported as `AI_INPUT_RESERVED`; neither is fetched nor charged. A site whose robots.txt answers with a server error is treated as closed (`ROBOTS_UNREACHABLE`), as the robots.txt standard asks.
- **Polite pace.** At most 2 requests at a time and 4 per second to any one site, slower when robots.txt sets a Crawl-delay (honoured up to 5 s). Requests identify the actor in their User-Agent.
- **Main-content extraction** scores the page's text blocks (paragraph length, commas, link density, class names) to find the article, the way browser reader modes do, and keeps sections split across several blocks together. Turn **Main content only** off to convert the whole body.
- **Character sets** are read from the server header or the page's meta tag, so pages in any encoding come out as UTF-8.
- Only public `http`/`https` addresses are fetched; private and internal addresses are refused (`BLOCKED_ADDRESS`).

### Results, zeros and errors

Every page you list gets a row. Rows with a status other than `OK` are free and say why in `message`:

| Status | Meaning |
| --- | --- |
| `JS_SHELL` | The page needs JavaScript to show its text; the served HTML is an empty app shell |
| `EMPTY_PAGE` | The page has no readable text |
| `ROBOTS_DISALLOWED`, `AI_INPUT_RESERVED`, `ROBOTS_UNREACHABLE` | The site's robots.txt does not allow it (see above) |
| `HTTP_ERROR` | The site answered with an error (`httpStatus` says which: 404, 403, 500...) |
| `UNSUPPORTED_CONTENT_TYPE` | Not a web page (PDF, image, JSON, ZIP...) |
| `TIMEOUT`, `NETWORK_ERROR`, `DNS_ERROR`, `TLS_ERROR` | The site did not answer properly |
| `INVALID_URL`, `BLOCKED_ADDRESS`, `TOO_MANY_REDIRECTS`, `DUPLICATE` | The URL could not or should not be fetched |

During a crawl, links that robots.txt disallows and pages already converted in the run are skipped silently (counted in the run's status message).

The run ends with a status such as `DELIVERED: 98 page(s) converted to Markdown. Not converted, not charged: 1 HTTP error (403 x1), 1 JavaScript-only`. A run where nothing could be converted because sites refused or did not answer ends FAILED; a run where every page got a definite answer (JS shell, 404, robots.txt) ends SUCCEEDED with `NOTHING_TO_CONVERT`. Invalid input ends right away with an `Input error: ...` message and only the $0.001 start charge.

### Pricing

- $0.001 per run (start).
- **$1.00 per 1,000 converted pages on Free**, with lower prices on higher Apify plans ($0.70 per 1,000 on Gold). Platform usage is included.
- **Large pages:** a page with more than 1 MB of HTML adds $0.001 per extra started MB on Free ($0.0007 on Gold). A 1.5 MB page costs $0.002, a 2.5 MB page $0.003. Typical articles and docs pages are well under 1 MB.
- **Free:** every page that was not converted (JS shells, empty pages, robots.txt, HTTP errors, timeouts, non-HTML files, duplicates).

Set a maximum charge per run in Apify if you want a hard ceiling; the actor checks it before fetching each page, stops at it and says so in the status.

### FAQ

**Does it run JavaScript?** No. It is a fast HTTP fetch. Pages that only render in a browser are flagged `JS_SHELL` and cost nothing, so you know which URLs need a browser-based tool.

**Can it crawl a whole site?** It follows same-site links up to 5 levels deep, up to 1,000 pages per start URL and 10,000 per run. With **Crawl only under the start URL's folder** on, a crawl from `/docs/guide/` stays in `/docs/guide/`.

**How are tokens counted?** `tokenEstimate` is an estimate (about 4 characters per token for Latin scripts, 1 token per Chinese or Japanese character), good for sizing chunks and budgets. Use your model's tokenizer for exact counts.

**Why was a page skipped by robots.txt?** The site asked crawlers not to fetch that path. The actor respects that for every URL, including the ones you list.

**Can I convert PDFs?** Not with this actor: PDF links come back as `UNSUPPORTED_CONTENT_TYPE` (free).

### Data use

The actor fetches only the public pages you list (and, if you ask, same-site pages they link to), follows each site's robots.txt and identifies itself in its User-Agent. You are responsible for how you use the content: respect each site's terms and copyright, and do not use it to collect personal data.

# Changelog

This Actor's version history is a separate document: https://apify.com/tagadanar/web-page-to-markdown/changelog.md

# Actor input Schema

## `startUrls` (type: `array`):

The pages to convert, one URL per line (up to 5,000 per run). A bare domain like example.com is read as https://example.com. Each page becomes one row with its Markdown, plain text and metadata.

## `maxCrawlDepth` (type: `integer`):

0 = convert only the listed pages. 1 = also the same-site pages they link to, 2 = the pages those link to, and so on (max 5).

## `maxPagesPerStartUrl` (type: `integer`):

With a crawl depth of 1 or more: the most pages fetched for each start URL, the start page included (max 1,000). The whole run stops at 10,000 pages.

## `stayWithinStartPath` (type: `boolean`):

On: from https://docs.example.com/guide/intro the crawl follows only links under /guide/. Off: any page of the same site.

## `extractMainContent` (type: `boolean`):

On: keep the article or main text and drop menus, headers, footers, sidebars and cookie banners. Off: convert the whole page body.

## `includeImages` (type: `boolean`):

On: images appear as ![alt](url) in the Markdown. Off (default): images are left out, which keeps the text lean for language models.

## Actor input object example

```json
{
  "startUrls": [
    "https://en.wikipedia.org/wiki/Markdown",
    "https://docs.python.org/3/tutorial/introduction.html"
  ],
  "maxCrawlDepth": 0,
  "maxPagesPerStartUrl": 20,
  "stayWithinStartPath": true,
  "extractMainContent": true,
  "includeImages": false
}
```

# Actor output Schema

## `dataset` (type: `string`):

No description

# API

You can run this Actor programmatically using our API. Below are code examples in JavaScript, Python, and CLI, as well as the OpenAPI specification and MCP server setup.

## JavaScript example

```javascript
import { ApifyClient } from 'apify-client';

// Initialize the ApifyClient with your Apify API token
// Replace the '<YOUR_API_TOKEN>' with your token
const client = new ApifyClient({
    token: '<YOUR_API_TOKEN>',
});

// Prepare Actor input
const input = {
    "startUrls": [
        "https://en.wikipedia.org/wiki/Markdown",
        "https://docs.python.org/3/tutorial/introduction.html"
    ]
};

// Run the Actor and wait for it to finish
const run = await client.actor("tagadanar/web-page-to-markdown").call(input);

// Fetch and print Actor results from the run's dataset (if any)
console.log('Results from dataset');
console.log(`💾 Check your data here: https://console.apify.com/storage/datasets/${run.defaultDatasetId}`);
const { items } = await client.dataset(run.defaultDatasetId).listItems();
items.forEach((item) => {
    console.dir(item);
});

// 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/js/docs

```

## Python example

```python
from apify_client import ApifyClient

# Initialize the ApifyClient with your Apify API token
# Replace '<YOUR_API_TOKEN>' with your token.
client = ApifyClient("<YOUR_API_TOKEN>")

# Prepare the Actor input
run_input = { "startUrls": [
        "https://en.wikipedia.org/wiki/Markdown",
        "https://docs.python.org/3/tutorial/introduction.html",
    ] }

# Run the Actor and wait for it to finish
run = client.actor("tagadanar/web-page-to-markdown").call(run_input=run_input)

# Fetch and print Actor results from the run's dataset (if there are any)
print(f"💾 Check your data here: https://console.apify.com/storage/datasets/{run.default_dataset_id}")
for item in client.dataset(run.default_dataset_id).iterate_items():
    print(item)

# 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/python/docs/quick-start

```

## CLI example

```bash
echo '{
  "startUrls": [
    "https://en.wikipedia.org/wiki/Markdown",
    "https://docs.python.org/3/tutorial/introduction.html"
  ]
}' |
apify call tagadanar/web-page-to-markdown --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,tagadanar/web-page-to-markdown"
        }
    }
}
```

The hosted server signs you in with OAuth on first connect, so no API token belongs in this config. Clients without OAuth support can send an `Authorization: Bearer <APIFY_API_TOKEN>` header instead, using a token from API & Integrations in Apify Console (https://console.apify.com/settings/integrations).

## OpenAPI specification

Download the OpenAPI definition: https://api.apify.com/v2/actors/PQjfR6CViJVvb2Hof/builds/SMcVjF4JmjzV92PJv/openapi.json
