# Website to Markdown + PDF & Office Docs, llms.txt for RAG (`greenrun/website-to-markdown`) Actor

Crawl a website into clean Markdown for LLMs, RAG and AI agents. Linked PDF, Word, PowerPoint and Excel files are converted too. Writes llms.txt and llms-full.txt. Inputs like Website Content Crawler. robots.txt respected; blocked and empty pages under 1 MB are free.

- **URL**: https://apify.com/greenrun/website-to-markdown.md
- **Developed by:** [Greenrun](https://apify.com/greenrun) (community)
- **Features:** Limited permissions
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $2.00 / 1,000 pages

This Actor is paid per event. You are not charged for the Apify platform usage, but only a fixed price for specific events.

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

## Website to Markdown for RAG and AI Agents: Pages, PDFs, Office Docs, llms.txt

Turn a public website into clean Markdown for LLMs, RAG pipelines and AI agents. One run crawls the pages under your start URLs **and converts the PDF, Word, PowerPoint and Excel files they link to**. You also get a ready **llms.txt** index and **llms-full.txt** with all the content in one file. Input and output fields follow Website Content Crawler, so existing inputs and code keep working. **You pay per saved page; blocked, failed, empty and duplicate pages are free.**

### What it does

- **Crawls** the pages under your start URLs with the same scope rules as Website Content Crawler: URL prefix, include and exclude globs, maximum depth and pages, optional sitemaps and `/llms.txt`.
- **Extracts the main content** of each page (its `<main>` or single `<article>` element, otherwise Readability) and converts it to Markdown with headings, lists, tables, code blocks with their language, and absolute links. Navigation, footers, cookie banners, edit links and similar page chrome are removed.
- **Converts linked documents**: PDF, DOCX, PPTX, XLSX, XLS and EPUB, with tables and page markers, using the engine of [Document to Markdown](https://apify.com/greenrun/document-to-markdown). OCR for scanned PDFs is optional. Each document is its own result.
- **Writes llms.txt and llms-full.txt** to the key-value store of the run: an index of every page and document in the [llmstxt.org](https://llmstxt.org) format, and all the Markdown in one file.
- **Uses the site's own Markdown** when the site serves it to clients that accept `text/markdown`.
- **Skips duplicates**: pages whose canonical URL was already saved, redirects to a saved page, and pages with identical text.
- **Reports every skipped URL** in `CRAWL-REPORT` with the reason. They are not charged (pages over 1 MB excepted, see Pricing).

### Why use it

- **Your knowledge base in one run.** Pages and the documents attached to them, all as Markdown. Website Content Crawler stores linked files as they are; here a PDF manual or an Excel price list comes back as text and tables.
- **llms.txt included**, ready to publish on your site or to hand to an agent.
- **Drop-in input.** Paste an input from Website Content Crawler. Browser and proxy fields are accepted and not used; the run notes them in `CRAWL-REPORT`.
- **Predictable price.** A fixed price per page and per document; a page pays one event unless it is unusually slow or large. Set a maximum charge for the run and the crawl stops cleanly when it is reached.
- **Respectful crawling.** robots.txt is always respected, including `Crawl-delay` and the Content-Signal preference `ai-input=no`. No proxies, no CAPTCHA solving, no login. Each result keeps the site's Content-Signal preferences (for example `ai-train=no`) in `metadata.contentSignal`, so you can honor them downstream.
- **Limited permissions.** The Actor only touches its own run storage.

### When Website Content Crawler is the better choice

This Actor fetches pages over HTTP without a browser. Sites that render their content only with JavaScript (single-page apps) come back empty here; such pages are free and listed in `CRAWL-REPORT` as `empty`. Sites behind bot protection or a login are skipped as well. For those, use a browser-based crawler.

### How to use

#### In Apify Console

Add one or more start URLs, set **Max pages**, and press **Start**. The **Output** tab links to the pages and documents, llms.txt, llms-full.txt and the crawl report.

#### From an AI agent (MCP)

Connect any MCP client to the Apify MCP server with only this Actor as a tool:

```
https://mcp.apify.com?tools=greenrun/website-to-markdown
```

#### Through the API

```bash
curl -X POST "https://api.apify.com/v2/acts/greenrun~website-to-markdown/run-sync-get-dataset-items" \
  -H "Authorization: Bearer <APIFY_TOKEN>" \
  -H "Content-Type: application/json" \
  -d '{"startUrls": [{"url": "https://docs.example.com/"}], "maxCrawlPages": 200}'
```

The field names of the results match Website Content Crawler (`url`, `crawl`, `metadata`, `text`, `markdown`), so code that reads those fields needs no changes.

### Input

| Field | Default | Description |
|---|---|---|
| `startUrls` | | Pages to start from. Pages whose URL starts with a start URL are crawled. A sitemap URL is read as a list of pages |
| `maxCrawlPages` | `1000` | Stop after fetching this many pages |
| `maxCrawlDepth` | `20` | Links away from a start URL |
| `convertDocuments` | `true` | Convert linked PDF, DOCX, PPTX, XLSX, XLS and EPUB files |
| `maxDocuments` | `100` | Documents converted per run; `0` turns conversion off |
| `documentsFromOtherDomains` | `false` | Also convert documents hosted on other domains than the start URLs |
| `useSitemaps` | `false` | Also crawl the pages listed in the sitemaps of the start URL domains |
| `generateLlmsTxt` | `true` | Write llms.txt and llms-full.txt |
| `includeUrlGlobs`, `excludeUrlGlobs` | `[]` | Globs such as `https://example.com/docs/**` |
| `htmlTransformer` | `readableText` | `readableText` (main content) or `none` (whole page) |
| `removeElementsCssSelector` | as in Website Content Crawler | Elements removed before extraction |
| `keepElementsCssSelector` | | Keep only these elements |
| `ocr` | `off` | `auto` reads scanned PDF pages with OCR, billed per OCR page |
| `maxConcurrency` | `5` | Pages fetched at the same time; a robots.txt Crawl-delay always takes precedence |

Accepted for compatibility and not used: `crawlerType`, `proxyConfiguration`, `initialCookies`, `customHttpHeaders`, `saveFiles`. `respectRobotsTxtFile` is always on.

### Output

One dataset item per page or document. Real output from a run on 19 November 2026, with the text shortened:

```json
{
  "url": "https://www.rfc-editor.org/rfc/rfc9309.pdf",
  "crawl": {
    "loadedUrl": "https://www.rfc-editor.org/rfc/rfc9309.pdf",
    "loadedTime": "2026-11-19T16:33:57.528Z",
    "referrerUrl": "https://www.rfc-editor.org/info/rfc9309/",
    "depth": 1,
    "httpStatusCode": 200
  },
  "metadata": {
    "canonicalUrl": null,
    "title": "RFC 9309: Robots Exclusion Protocol",
    "headers": {"content-type": "application/pdf"},
    "contentSignal": null
  },
  "type": "document",
  "text": "<!-- page 1 -->\n\nStream: Internet Engineering Task Force (IETF)\nRFC: 9309 ...",
  "markdown": "<!-- page 1 -->\n\nStream: Internet Engineering Task Force (IETF)\nRFC: 9309 ...",
  "markdownUrl": null,
  "document": {
    "fileName": "rfc9309.pdf",
    "format": "pdf",
    "contentType": "application/pdf",
    "sizeBytes": 177688,
    "pageCount": 12,
    "pagesProcessed": 12,
    "truncated": false,
    "tablesFound": 0,
    "ocrPages": 0,
    "processingMs": 991
  },
  "warnings": [],
  "billableEvents": {"document": 1},
  "workGbSecs": 4.8
}
```

Pages have the same shape with `"type": "page"`, `"document": null` and the full page metadata: `canonicalUrl`, `title`, `description`, `author`, `keywords`, `languageCode`, `siteName`, `openGraph` and selected response headers.

#### llms.txt

```markdown
## docs.apify.com and 1 more sites

> Markdown version of 15 pages and 1 document from docs.apify.com, www.rfc-editor.org.

Crawled from https://docs.apify.com/academy/scraping-basics-javascript, https://www.rfc-editor.org/info/rfc9309 on 2026-11-19: 15 pages and 1 document converted to Markdown. The full text of every page is in llms-full.txt next to this file.

### docs.apify.com / Academy

- [Web scraping basics for JavaScript devs](https://docs.apify.com/academy/scraping-basics-javascript)
- [Extracting data from a web page with browser DevTools](https://docs.apify.com/academy/scraping-basics-javascript/devtools-extracting-data.md)
...

### Documents

- [RFC 9309: Robots Exclusion Protocol](https://www.rfc-editor.org/rfc/rfc9309.pdf): PDF, 12 pages
```

`llms-full.txt` holds every page and document as `# Title`, `Source: URL` and the Markdown, one after another.

### Pricing

Pay per event, no subscription:

| Event | Price | When |
|---|---|---|
| Actor start | $0.0045 per GB of memory | Each run: $0.0045 at the default 1 GB |
| Page | $0.002 | Each page saved with text ($2.00 per 1,000 pages), covering 19.2 GB-seconds of its work (19.2 s at 1 GB, shared with the pages fetched at the same time); one more for each further started 19.2 GB-seconds (very slow or very large pages) |
| Document | $0.005 | Each linked document downloaded and recognized as PDF or Office, including up to 20 PDF pages and 48 GB-seconds of work; one more for each further started 48 GB-seconds its page events do not cover |
| Extra document page | $0.0002 | Each PDF page above 20 |
| OCR page | $0.01 | Each page read with OCR, only when you turn OCR on, charged before the OCR runs |

Free: pages and documents disallowed by robots.txt or refused by the site, failed requests, pages without text (JavaScript-only), duplicates and unsupported files. Two exceptions: a page over 1 MB of HTML is charged once downloaded (its conversion takes long), even if it then turns out empty or a duplicate; a document is charged once its file is recognized, also when it has no text or its conversion fails. `billableEvents` and `workGbSecs` in each result show what it was charged for; charged pages that were not saved are listed in `CRAWL-REPORT` with `charged`.

Example: 500 pages and 20 PDFs of up to 20 pages cost 500 × $0.002 + 20 × $0.005 = $1.10 plus the start.

Every run stays within what its charges pay for: free work (blocked, failed, empty and duplicate pages, sitemaps) goes on only while the run's charges pay for it. A crawl that finds only free pages stops once its Actor start is used up and lists the URLs it did not try in `CRAWL-REPORT` (`notProcessedInputs`). You can cap the cost of a run with the maximum charge in the run options (at least $0.025); the crawl stops cleanly at that limit and still writes llms.txt.

### Limits

- No JavaScript rendering, no proxies, no login.
- robots.txt is always respected; a site that asks for a Crawl-delay longer than 60 seconds is skipped.
- Documents: PDF, DOCX, PPTX, XLSX, XLS and EPUB up to 50 MB (adjustable). Old .doc and .ppt files are not supported.
- By default only documents on the start URL domains (and their subdomains) are converted.
- Pages: up to 3 MB of HTML for each GB of memory (3 MB at the default 1 GB, 10 MB from 4 GB); a longer page is converted from its beginning, with a warning.
- The default 1 GB of memory suits most sites; large PDFs with many tables may need 2 GB.

### FAQ

**Do you keep the data?** No. Results stay in your run's dataset and key-value store in your own Apify account, under your data retention settings.

**Why was a page skipped?** Open the `CRAWL-REPORT` record in the key-value store: every skipped URL is listed with the reason, such as robots.txt, a duplicate or an empty page.

**A page or document is converted badly?** Open an issue on the Actor's **Issues** tab with the URL.

# Actor input Schema

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

Pages to start from. The crawler follows links to pages whose URL starts with one of these URLs (like Website Content Crawler). A sitemap URL (ending with .xml) is read as a list of pages.

## `maxCrawlPages` (type: `integer`):

Stop after fetching this many pages, counting start URLs and pages that turn out empty or duplicate. Documents are limited separately by Max documents.

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

How many links away from a start URL to go. Start URLs are depth 0; pages found in sitemaps are depth 1.

## `convertDocuments` (type: `boolean`):

Convert PDF, DOCX, PPTX, XLSX, XLS and EPUB files linked from crawled pages to Markdown, with tables and page markers, also outside the start URL path (like Website Content Crawler files). Each document is a separate result.

## `maxDocuments` (type: `integer`):

Convert at most this many documents per run. Links that turn out not to be documents do not count. 0 turns document conversion off.

## `documentsFromOtherDomains` (type: `boolean`):

Also convert documents hosted on other domains than the start URLs (for example PDFs on a CDN or cited papers). Off: only the start URL domains and their subdomains.

## `useSitemaps` (type: `boolean`):

Also read the sitemaps of the start URL domains (from robots.txt, or /sitemap.xml) and crawl the pages in scope.

## `generateLlmsTxt` (type: `boolean`):

After the crawl, save llms.txt (an index of all pages and documents in the llmstxt.org format) and llms-full.txt (all Markdown in one file) to the key-value store of the run.

## `includeUrlGlobs` (type: `array`):

Crawl only pages matching these globs, for example https://example.com/docs/\*\*. Setting this replaces the start URL prefix rule.

## `excludeUrlGlobs` (type: `array`):

Skip pages and documents matching these globs, for example https://example.com/blog/\*\*.

## `maxResults` (type: `integer`):

Stop after saving this many pages and documents together.

## `useLlmsTxt` (type: `boolean`):

Also read /llms.txt of the start URL domains and crawl the pages it links to (in scope). Markdown pages are saved as they are.

## `ignoreCanonicalUrl` (type: `boolean`):

By default a page whose canonical URL was already saved is skipped (not charged). Turn this on to save such pages anyway.

## `keepUrlFragments` (type: `boolean`):

Treat https://example.com/#a and https://example.com/#b as different pages. Only for sites that serve different content per fragment.

## `htmlTransformer` (type: `string`):

readableText: the main content of the page: its main element (or its only article element) when it has one, otherwise the content found by Readability, otherwise the whole page. Tables and code blocks are kept. none: the whole page after removing the elements below. readableTextIfPossible, extractus and defuddle are accepted for compatibility and work as readableText.

## `removeElementsCssSelector` (type: `string`):

Elements removed before extracting the content. The default is the same as in Website Content Crawler: navigation, footers, scripts, inline images, alerts, banners and dialogs.

## `keepElementsCssSelector` (type: `string`):

If set, only elements matching this selector are kept, for example article, .docs-content. Runs before the HTML transformer.

## `removeCookieWarnings` (type: `boolean`):

Remove common cookie consent banners (OneTrust, Cookiebot, Usercentrics, Didomi and similar) from the HTML.

## `saveMarkdown` (type: `boolean`):

Save the markdown field. Plain text is always saved in the text field.

## `readableTextCharThreshold` (type: `integer`):

When Readability finds fewer characters than this, the main element or the whole page is used instead.

## `maxDocumentPages` (type: `integer`):

Stop converting a PDF after this many pages. Pages above 20 are billed as extra pages.

## `maxDocumentSizeMb` (type: `integer`):

Larger documents are skipped and not charged.

## `ocr` (type: `string`):

off: no OCR (a scanned PDF has no text, is reported in CRAWL-REPORT and not charged). auto: OCR only pages without a text layer, billed per OCR page. force: OCR every page.

## `ocrLanguages` (type: `string`):

Tesseract language codes joined with +, for example eng+pol. Available: eng, pol, deu, fra, spa, ita, por, nld.

## `maxConcurrency` (type: `integer`):

Pages fetched at the same time. A Crawl-delay in robots.txt always takes precedence and spaces requests to that site. Values above 50 are treated as 50 (no browser is used, so higher values add no speed).

## `maxRequestRetries` (type: `integer`):

Retries after timeouts, HTTP 429 and 5xx, with growing pauses. Blocked requests (401, 403) are never retried. Values above 10 are treated as 10.

## `requestTimeoutSecs` (type: `integer`):

Timeout for one HTTP request. Values below 5 are treated as 5.

## `crawlerType` (type: `string`):

Accepted so inputs from Website Content Crawler work unchanged (playwright:adaptive, playwright:firefox, cheerio and others). This Actor always fetches over HTTP without a browser.

## `proxyConfiguration` (type: `object`):

Accepted for compatibility and not used: this Actor connects directly, without proxies.

## `respectRobotsTxtFile` (type: `boolean`):

Accepted for compatibility. robots.txt is always respected.

## `saveFiles` (type: `boolean`):

Accepted for compatibility. Use convertDocuments.

## `initialCookies` (type: `array`):

Accepted for compatibility and not used: public pages only.

## `customHttpHeaders` (type: `object`):

Accepted for compatibility and not used.

## Actor input object example

```json
{
  "startUrls": [
    {
      "url": "https://docs.apify.com/academy/scraping-basics-javascript"
    },
    {
      "url": "https://www.rfc-editor.org/info/rfc9309"
    }
  ],
  "maxCrawlPages": 20,
  "maxCrawlDepth": 20,
  "convertDocuments": true,
  "maxDocuments": 100,
  "documentsFromOtherDomains": false,
  "useSitemaps": false,
  "generateLlmsTxt": true,
  "includeUrlGlobs": [],
  "excludeUrlGlobs": [],
  "maxResults": 9999999,
  "useLlmsTxt": false,
  "ignoreCanonicalUrl": false,
  "keepUrlFragments": false,
  "htmlTransformer": "readableText",
  "removeElementsCssSelector": "nav, footer, script, style, noscript, svg, img[src^='data:'],\n[role=\"alert\"],\n[role=\"banner\"],\n[role=\"dialog\"],\n[role=\"alertdialog\"],\n[role=\"region\"][aria-label*=\"skip\" i],\n[aria-modal=\"true\"]",
  "keepElementsCssSelector": "",
  "removeCookieWarnings": true,
  "saveMarkdown": true,
  "readableTextCharThreshold": 100,
  "maxDocumentPages": 200,
  "maxDocumentSizeMb": 50,
  "ocr": "off",
  "ocrLanguages": "eng",
  "maxConcurrency": 5,
  "maxRequestRetries": 3,
  "requestTimeoutSecs": 60
}
```

# Actor output Schema

## `results` (type: `string`):

No description

## `llmsTxt` (type: `string`):

No description

## `llmsFullTxt` (type: `string`):

No description

## `report` (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": [
        {
            "url": "https://docs.apify.com/academy/scraping-basics-javascript"
        },
        {
            "url": "https://www.rfc-editor.org/info/rfc9309"
        }
    ],
    "maxCrawlPages": 20
};

// Run the Actor and wait for it to finish
const run = await client.actor("greenrun/website-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": [
        { "url": "https://docs.apify.com/academy/scraping-basics-javascript" },
        { "url": "https://www.rfc-editor.org/info/rfc9309" },
    ],
    "maxCrawlPages": 20,
}

# Run the Actor and wait for it to finish
run = client.actor("greenrun/website-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": [
    {
      "url": "https://docs.apify.com/academy/scraping-basics-javascript"
    },
    {
      "url": "https://www.rfc-editor.org/info/rfc9309"
    }
  ],
  "maxCrawlPages": 20
}' |
apify call greenrun/website-to-markdown --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,greenrun/website-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/dGZMhNw3gyWqd7a9j/builds/uL3lUR8AFql4fcT9e/openapi.json
