# Website to Markdown: Pages and Sites to Markdown for LLM, RAG (`joesimo/website-to-markdown`) Actor

Turn web pages or whole sites into clean Markdown for LLMs, RAG and AI agents. Main-content extraction drops menus and ads, links and images become absolute, tables stay as tables. Same-site crawl, metadata, word counts and optional chunks. Fast HTTP, no browser, no login.

- **URL**: https://apify.com/joesimo/website-to-markdown.md
- **Developed by:** [Joe Simo](https://apify.com/joesimo) (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

$1.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: Pages and Sites to Markdown for LLM, RAG

Convert web pages, docs sites and blogs into clean Markdown that an LLM can read. Paste page URLs, or turn on the same-site crawl to convert a whole section such as `/docs/`. You get one row per page with the Markdown, title, description, language, canonical URL, author, publish date, headings, word count and, if you want, ready-made chunks for embeddings.

Plain HTTP, no browser, no login, no proxy. Respects robots.txt by default. $1 per 1,000 converted pages; pages that fail are free.

### What you can do with it

- Build a RAG knowledge base from product docs, help centers, wikis or blogs.
- Give an AI agent or a custom GPT the text of a page without menus, cookie banners, ads and scripts.
- Archive articles as Markdown files in Git, Notion, Obsidian or a CMS.
- Feed page text to summarizers, translators, classifiers or keyword tools.
- Count words and check headings across a site for a content audit.

### How it works

1. Fetches each page over HTTP with a descriptive User-Agent, follows redirects and retries on 429 and 503.
2. Finds the main content with Mozilla Readability (the engine behind Firefox Reader View). If a page has little article text, it falls back to the whole body without nav, header, footer, aside, forms and scripts.
3. Converts to Markdown with Turndown: ATX headings, fenced code blocks, GitHub tables, lists, bold and italics. Links and images become absolute URLs; `javascript:` links and inline base64 images are dropped.
4. With Crawl on, it follows links to other pages of the same site, up to your page and depth limits, with include and exclude URL patterns.

### Input

```json
{
    "startUrls": ["https://go.dev/doc/"],
    "crawl": true,
    "maxPages": 100,
    "maxCrawlDepth": 2,
    "includeUrlPatterns": ["/doc/"],
    "contentMode": "article",
    "chunkSize": 3000
}
```

| Field | Default | What it does |
|---|---|---|
| `startUrls` | demo pages | Pages to convert. Bare domains work. |
| `crawl` | `false` | Follow same-site links (www and non-www count as one site). |
| `maxPages` | `100` | Upper limit of pages fetched in the run. |
| `maxCrawlDepth` | `2` | Clicks away from a start URL. |
| `includeUrlPatterns` / `excludeUrlPatterns` | none | Text or `/regex/` to limit the crawl. |
| `contentMode` | `article` | `article` = main content only, `full` = whole body. |
| `keepPageChrome` | `false` | Full mode only: keep nav, header and footer. |
| `includeLinks` / `includeImages` | `true` | Turn off for smaller text for embeddings. |
| `addTitleHeading` | `true` | Start the Markdown with `# Page title`. |
| `chunkSize` | `0` | Characters per chunk, split at headings and paragraphs. 0 = off. |
| `maxMarkdownChars` | `0` | Cut long pages (marked `truncated`). 0 = no limit. |
| `respectRobotsTxt` | `true` | Skip pages disallowed for all user agents. |
| `concurrency` | `5` | Requests in flight. Each host also gets a 250 ms gap. |

### Output

One dataset row per page:

```json
{
    "url": "https://go.dev/blog/go1.22",
    "finalUrl": "https://go.dev/blog/go1.22",
    "statusCode": 200,
    "depth": 0,
    "status": "ok",
    "title": "Go 1.22 is released! - The Go Programming Language",
    "description": "Go 1.22 enhances for loops, brings new standard library functionality and improves performance.",
    "language": "en",
    "canonicalUrl": "https://go.dev/blog/go1.22",
    "author": "Eli Bendersky, on behalf of the Go team 6 February 2024",
    "contentMode": "article",
    "wordCount": 423,
    "charCount": 3410,
    "truncated": false,
    "headings": [{ "level": 2, "text": "Language changes" }],
    "linkCount": 13,
    "imageCount": 0,
    "markdown": "# Go 1.22 is released! ...\n\nToday the Go team is thrilled to release Go 1.22 ...",
    "crawledAt": "2026-11-11T07:10:00.000Z"
}
```

Pages that are not converted get a free row with `status` and `error`: `not_found`, `failed`, `not_html` (PDF, JSON, images), `robots_blocked`, `empty` (no readable text, often a page that needs JavaScript) or `invalid_input`. The run summary (pages converted, failures, words, stop reason) is saved as `OUTPUT` in the key-value store.

Download the dataset as JSON, CSV, Excel or JSONL, or read it from the API. To get one Markdown file per page, loop over the JSON rows and write `markdown` to a file named after `url`.

### Pricing

Pay per event: **$0.001 per page converted** ($1 per 1,000 pages). Failed, not found, non-HTML, robots-blocked and empty pages and invalid inputs are free. Set a maximum cost per run in the run options and the Actor stops cleanly when it is reached.

### FAQ

**Can I convert a whole website to Markdown, not just one page?** Yes. Turn on **Crawl the same site** and the Actor follows links to other pages of the same site, up to **Max pages** and **Max crawl depth**. Use **Only crawl URLs containing** (for example `/docs/`) to keep the crawl to one section. Each page becomes its own dataset row.

**Can I use it as a URL to Markdown converter for a list of URLs?** Yes. Paste one URL per line; bare domains like `example.com` work too. You get one row per URL with the Markdown plus title, description, language, canonical URL, author, word count and headings. Duplicate and invalid URLs get a free `invalid_input` row.

**Can I paste raw HTML to convert HTML to Markdown?** No, the input is page URLs. The Actor downloads the HTML of each page and converts it with Turndown, keeping headings, lists, tables and fenced code blocks, with links and images made absolute. Pick **Whole page body** if you want everything on the page instead of the main content only.

**Is the output LLM ready for RAG?** It is clean Markdown with menus, footers, ads and scripts removed in the default main-content mode. Set **Chunk size** to also get a `chunks` array split at headings and paragraphs, and turn off **Keep links** and **Keep images** for smaller text. The Actor does not create embeddings or write to a vector database; load the rows into your own pipeline.

**Does this Markdown scraper work on JavaScript-heavy sites?** Not on pages that build their text in the browser. It uses plain HTTP without a browser, so such pages come back as a free `empty` row. Server-rendered docs, blogs, news sites and wikis convert well.

### Limits

- No JavaScript rendering. Pages that build their text in the browser (some single-page apps) come back as `empty`. Server-rendered sites, docs, blogs, news and wikis work well.
- No login, no paywalls, no captcha solving, no proxies.
- Use it on public pages you may read and reuse. Check each site's terms before you republish its text.

### Related Actors by joesimo

- [Sitemap Extractor](https://apify.com/joesimo/sitemap-extractor): list every URL of a site, then feed them here.
- [RSS Feed Reader](https://apify.com/joesimo/rss-feed-reader): new posts from blogs and news sites.
- [PDF Text Extractor](https://apify.com/joesimo/pdf-text-extractor): text from PDF files.
- [SEO Audit](https://apify.com/joesimo/seo-audit): titles, meta tags and headings across a site.

# Actor input Schema

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

Pages to convert, one per line. Bare domains work (example.com). Leave empty to try 3 demo pages.

## `crawl` (type: `boolean`):

Also follow links on each page to other pages of the same site (www and non-www count as one site), up to Max pages and Max crawl depth.

## `maxPages` (type: `integer`):

Upper limit of pages fetched in this run, start URLs included.

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

How many clicks away from a start URL the crawl may go. Used only when Crawl is on.

## `includeUrlPatterns` (type: `array`):

Optional. Text (for example /docs/) or a regular expression in slashes (for example //blog/\d{4}//). Start URLs are always converted.

## `excludeUrlPatterns` (type: `array`):

Optional. Text or /regex/. Matching links are not crawled.

## `contentMode` (type: `string`):

Main content uses Mozilla Readability and falls back to the whole body when a page has little article text.

## `keepPageChrome` (type: `boolean`):

Whole page mode only. Off removes nav, header, footer and aside blocks.

## `includeLinks` (type: `boolean`):

Off turns links into plain text (smaller output for embeddings).

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

Off drops image tags from the Markdown.

## `addTitleHeading` (type: `boolean`):

Adds '# Title' at the top when the Markdown does not already start with a top-level heading.

## `chunkSize` (type: `integer`):

0 = off. Otherwise also return a chunks array split at headings and paragraphs, ready for embeddings.

## `maxMarkdownChars` (type: `integer`):

0 = no limit. Longer pages are cut and marked truncated.

## `respectRobotsTxt` (type: `boolean`):

Pages disallowed for all user agents are skipped (free row, status robots_blocked). Turn off only for sites you own or have permission to crawl.

## `concurrency` (type: `integer`):

Requests in flight at once. Each host also gets a 250 ms gap between requests.

## `timeoutSecs` (type: `integer`):

Per request.

## Actor input object example

```json
{
  "startUrls": [
    "https://go.dev/blog/go1.22"
  ],
  "crawl": false,
  "maxPages": 100,
  "maxCrawlDepth": 2,
  "contentMode": "article",
  "keepPageChrome": false,
  "includeLinks": true,
  "includeImages": true,
  "addTitleHeading": true,
  "chunkSize": 0,
  "maxMarkdownChars": 0,
  "respectRobotsTxt": true,
  "concurrency": 5,
  "timeoutSecs": 30
}
```

# Actor output Schema

## `pages` (type: `string`):

No description

## `summary` (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://go.dev/blog/go1.22"
    ]
};

// Run the Actor and wait for it to finish
const run = await client.actor("joesimo/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": ["https://go.dev/blog/go1.22"] }

# Run the Actor and wait for it to finish
run = client.actor("joesimo/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": [
    "https://go.dev/blog/go1.22"
  ]
}' |
apify call joesimo/website-to-markdown --silent --output-dataset

```

## MCP server setup

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