# Website to Markdown: Fast Crawler for LLMs, RAG & AI Agents (`kramer_labs/website-to-markdown`) Actor

Turn any website, docs, or blog into clean Markdown for LLMs and RAG. Main content only (menus, footers, cookie banners removed), headings, lists, tables, code and links kept. Follows the sitemap and links in scope; obeys robots.txt. $2 per 1,000 pages.

- **URL**: https://apify.com/kramer_labs/website-to-markdown.md
- **Developed by:** [Jackson Kramer](https://apify.com/kramer_labs) (community)
- **Categories:** AI, Developer tools
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

$2.00 / 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.

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: fast crawler for LLMs, RAG & AI agents

**Turn any website, docs site, or blog into clean Markdown, one row per page, ready for an LLM, a vector database, or an AI agent.** Only the main content is kept: menus, headers, footers, sidebars, and cookie banners are stripped. Headings, lists, tables, code blocks, and links come through as proper Markdown.

- **Fast and cheap:** plain HTTP with no browser. 8 docs pages convert in about 2 seconds.
- **Stays in scope:** start at `https://docs.example.com/v2/` and it only crawls pages under `/v2/` on that site. It uses the sitemap when there is one and follows links otherwise.
- **Clean Markdown:** `<main>`/`<article>` detection, ARIA landmarks and boilerplate classes removed, nested lists and tables kept, code fences preserved.
- **Polite:** obeys robots.txt and makes at most 4 requests at a time.

### Sample output (real, docs.python.org, Oct 2026)

```json
{
  "type": "page",
  "startUrl": "https://docs.python.org/3/library/json.html",
  "url": "https://docs.python.org/3/library/marshal.html",
  "loadedUrl": "https://docs.python.org/3/library/marshal.html",
  "title": "marshal — Internal Python object serialization — Python 3.15.2 documentation",
  "description": "This module contains functions that can read and write Python values in a binary format. …",
  "language": "en",
  "markdown": "# `marshal` — Internal Python object serialization\n\n---\n\nThis module contains functions that can read and write Python values in a binary format. The format is specific to Python, but independent of machine architecture issues … [shortened]",
  "wordCount": 995,
  "crawledAt": "2026-10-30T20:53:53+00:00"
}
```

That run converted 8 pages under `/3/library/` (json, pickle, decimal, mailbox…, 339 to 10,439 words each) in about 2 seconds.

### How to use

1. Add **start URLs**: a page, a docs section, or a homepage.
2. Set **max pages per start URL** (1 = just that page).
3. Optional: **only / skip URLs containing**, **follow links**, **use sitemap**, **main content only**, **keep links / images**.
4. Run, then export (JSON, CSV, Excel), or read the dataset from your RAG pipeline through the API, LangChain, or LlamaIndex.

#### Sample input

```json
{ "startUrls": ["https://docs.python.org/3/library/"], "maxPagesPerStartUrl": 50, "excludeUrlsContaining": ["/whatsnew/"] }
```

### Pricing

- **$0.002 per page converted** ($2 per 1,000 pages). No start fee.
- Pages that fail, aren't HTML, or are disallowed by robots.txt are free.

### Who it's for

- **RAG and chatbot builders:** load docs, help centers, and blogs into a vector store
- **AI agents:** give an agent clean page text instead of raw HTML
- **Content teams:** a Markdown copy of a site for migration, audits, or summaries
- **Researchers:** clean text from many pages for analysis

### Works well with

- [Sitemap URL Extractor](https://apify.com/kramer_labs/sitemap-url-extractor): list every URL first, then convert the ones you want
- [RSS Feed Reader](https://apify.com/kramer_labs/rss-feed-reader): watch for new posts, then convert them

### FAQ

**Does it run JavaScript?** No. That's why it's fast and cheap. Sites that build their pages entirely in JavaScript come back thin. For those, use a browser-based crawler.
**PDFs?** Skipped (free). HTML pages only.
**Will it crawl the whole internet from my start URL?** No. It stays on the same site and under the start URL's folder.

More tools from the same studio: [Kramer Labs](https://kramer-labs.netlify.app/).

### Data source and responsible use

It reads public web pages with ordinary requests, obeys each site's robots.txt (RFC 9309), and never logs in or bypasses blocks. Page content belongs to its owners: use it for indexing, analysis, and AI retrieval in line with each site's terms and copyright, and don't republish it as your own.

# Actor input Schema

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

Pages or sections to convert, e.g. https://docs.python.org/3/library/. Crawling stays on the same site and under the start URL's folder.

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

Caps cost. 1 = just the start page.

## `crawlLinks` (type: `boolean`):

Follow links to more pages in scope. Off = convert only the start URLs.

## `useSitemap` (type: `boolean`):

Also find in-scope pages from the site's sitemap (faster, more complete).

## `includeUrlsContaining` (type: `array`):

e.g. /docs/, /blog/. Leave empty for all pages in scope.

## `excludeUrlsContaining` (type: `array`):

e.g. /tag/, ?page=, /changelog.

## `mainContentOnly` (type: `boolean`):

Keep <main>/<article> content and drop navigation, headers, footers, sidebars, and cookie banners.

## `keepLinks` (type: `boolean`):

Keep [text](url) links in the Markdown. Turn off for plainer text.

## `keepImages` (type: `boolean`):

Keep ![alt](src) image references.

## Actor input object example

```json
{
  "startUrls": [
    "https://docs.python.org/3/library/json.html"
  ],
  "maxPagesPerStartUrl": 20,
  "crawlLinks": true,
  "useSitemap": true,
  "mainContentOnly": true,
  "keepLinks": true,
  "keepImages": false
}
```

# Actor output Schema

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

No description

## `allResults` (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://docs.python.org/3/library/json.html"
    ]
};

// Run the Actor and wait for it to finish
const run = await client.actor("kramer_labs/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://docs.python.org/3/library/json.html"] }

# Run the Actor and wait for it to finish
run = client.actor("kramer_labs/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://docs.python.org/3/library/json.html"
  ]
}' |
apify call kramer_labs/website-to-markdown --silent --output-dataset

```

## MCP server setup

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