# Website to Markdown for AI & RAG (Fast, No Browser) (`pankajbhatia/website-to-markdown`) Actor

Turn any web page or whole website into clean Markdown for LLMs, RAG and AI agents. Removes menus, ads and footers, keeps headings, lists and tables. Adds title, author, date. Fast and cheap: no browser.

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

## Pricing

from $1.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 for AI & RAG

Turn any web page, or a whole website, into **clean Markdown** ready for LLMs, RAG pipelines, vector databases and AI agents.

- **Main content only**: strips menus, cookie banners, ads, sidebars and footers. Keeps headings, lists, tables, bold/italic.
- **Metadata included**: title, description, author, published date, site name, language and word count.
- **One page or a whole site**: paste URLs, or turn on *Follow links* to crawl the same website (with depth, page limit and URL filters).
- **Fast and cheap**: plain HTTP, no browser, so hundreds of pages take a minute.
- **Polite**: respects robots.txt by default.
- **Pay only for pages that worked**: failed, blocked or empty pages come back as a free row with an `error` explaining why.

### Who is it for?

- **AI / RAG builders** loading docs, blogs or help centers into a vector database.
- **AI agents** that need to read a web page as clean text over the API.
- **Content and SEO teams** archiving or analyzing competitor content.

Tip: pair it with our **Sitemap & URL Extractor** to get every URL of a site first, then convert them all here.

### How to use it

1. Paste one or more **Start URLs**.
2. To convert a whole site, turn on **Follow links** and set **Max pages** and **Max depth**. Optionally limit it with URL include/exclude patterns.
3. Click **Start**, then download the Markdown as JSON, CSV or Excel, or load it straight into your vector database through the API.

### Input example

```json
{
  "startUrls": [{ "url": "https://docs.apify.com/academy" }],
  "followLinks": true,
  "maxPages": 100,
  "maxDepth": 2,
  "includePatterns": ["/academy/"]
}
```

### Output example

```json
{
  "url": "https://en.wikipedia.org/wiki/Web_scraping",
  "statusCode": 200,
  "title": "Web scraping - Wikipedia",
  "description": "…",
  "author": null,
  "publishedDate": "2026-09-30",
  "language": "en",
  "markdown": "# Web scraping\n\n**Web scraping**, **web harvesting**, or **web data extraction** is data scraping used for extracting data from websites…",
  "wordCount": 4326,
  "depth": 0,
  "crawledAt": "2026-10-08T18:55:01Z"
}
```

### How much does it cost?

Pay-per-event: a small fee **per page converted** plus a tiny per-run start fee. For example, 1,000 pages cost about $1. Failed pages are free. Set **Maximum cost per run** to cap spending; the Actor stops cleanly at your limit.

### Limits

- Pages that only show content after running JavaScript (some single-page apps) may return "No readable main content". Those rows are free.
- Only the same website is crawled when *Follow links* is on.
- Respect each website's terms of use; only convert content you're allowed to use.

### Use it through the API, integrations or AI agents

Run it from the Apify API, on a schedule, or connect it to Make, Zapier, n8n or Google Sheets. AI agents can find and call it through the Apify MCP server. Output is clean JSON with the same fields on every run.

### FAQ

**Is it legal?** It reads publicly available pages and respects robots.txt by default. Only convert content you're allowed to use, and respect each website's terms.

**Can I get plain text instead?** Markdown is plain text with light formatting; strip `#` and `*` if you need raw text.

**Is there a size limit?** Pages up to 15 MB of HTML.

**Found a page it can't read?** Open an issue with the URL. We usually reply within 24 hours.

### More tools from this developer

- [SAM.gov Contract Opportunities Finder & Bid Alerts](https://apify.com/pankajbhatia/sam-gov-contract-opportunities): federal contract opportunities and bid alerts
- [Sitemap & URL Extractor](https://apify.com/pankajbhatia/sitemap-url-extractor): get every URL of a website from its sitemaps
- [Tech Stack Detector](https://apify.com/pankajbhatia/tech-stack-detector): find what any website is built with
- [Apple App Store Reviews Scraper](https://apify.com/pankajbhatia/app-store-reviews): App Store reviews and ratings for any app
- [ATS Jobs Scraper](https://apify.com/pankajbhatia/ats-jobs-scraper): jobs from Greenhouse, Lever, Ashby, Workable and more
- [Website Screenshot](https://apify.com/pankajbhatia/website-screenshot): full-page, mobile and PDF screenshots in bulk
- [PDF to Text & Markdown Extractor](https://apify.com/pankajbhatia/pdf-text-extractor): extract text from PDFs for AI and search
- [Domain WHOIS, DNS & SSL Checker](https://apify.com/pankajbhatia/domain-whois-dns-ssl-checker): bulk domain, DNS, email security and SSL checks
- [SEO Meta Tags & On-Page Audit](https://apify.com/pankajbhatia/seo-meta-tags-checker): bulk on-page SEO audit with fixes
- [Bulk URL Status & Broken Link Checker](https://apify.com/pankajbhatia/url-status-broken-link-checker): status codes, redirect chains and broken links
- [RSS & Atom Feed Reader](https://apify.com/pankajbhatia/rss-feed-reader): merge and filter many news feeds
- [Hacker News Scraper](https://apify.com/pankajbhatia/hacker-news-scraper): HN stories, comments and Who is hiring jobs
- [Academic Paper Search](https://apify.com/pankajbhatia/academic-paper-search): papers from Crossref, arXiv and PubMed
- [SEC EDGAR Filings & Financials](https://apify.com/pankajbhatia/sec-edgar-filings-financials): 10-K, 10-Q, 8-K filings and company financials

# Actor input Schema

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

Pages to convert. With 'Follow links' on, these are also the starting points of the crawl.

## `followLinks` (type: `boolean`):

Also convert pages linked from the start URLs, on the same website only.

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

Stop after this many converted pages. 0 = no limit.

## `maxDepth` (type: `integer`):

How many clicks away from the start URLs to follow (only with 'Follow links').

## `includePatterns` (type: `array`):

Plain text = contains (e.g. /docs/). Wildcards work. Prefix re: for a regex.

## `excludePatterns` (type: `array`):

Same syntax, e.g. /tag/, /login.

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

Keep hyperlinks as [text](url).

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

Keep images as ![alt](src).

## `minWords` (type: `integer`):

Pages with less main content are returned as a free error row instead.

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

Skip pages the site asks bots not to fetch. Recommended.

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

Parallel requests. Lower it for small sites.

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

How long to wait for each page.

## Actor input object example

```json
{
  "startUrls": [
    {
      "url": "https://docs.apify.com/academy"
    }
  ],
  "followLinks": false,
  "maxPages": 100,
  "maxDepth": 2,
  "includeLinks": false,
  "includeImages": false,
  "minWords": 0,
  "respectRobotsTxt": true,
  "maxConcurrency": 5,
  "requestTimeoutSecs": 30
}
```

# Actor output Schema

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

One item per page with clean Markdown and metadata.

# 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"
        }
    ]
};

// Run the Actor and wait for it to finish
const run = await client.actor("pankajbhatia/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" }] }

# Run the Actor and wait for it to finish
run = client.actor("pankajbhatia/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"
    }
  ]
}' |
apify call pankajbhatia/website-to-markdown --silent --output-dataset

```

## MCP server setup

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