# Broken Link Checker — Find 404s & Dead Links on Your Website (`reverend_sal/broken-link-checker`) Actor

Crawl your website and find every broken link, missing image, dead script/stylesheet, 404, 5xx, DNS/SSL error and redirect loop — with the exact pages and anchor text where each appears. Fast HTTP-only crawler, respects robots.txt, sitemap support.

- **URL**: https://apify.com/reverend_sal/broken-link-checker.md
- **Developed by:** [North Eng](https://apify.com/reverend_sal) (community)
- **Categories:** Developer tools, SEO tools
- **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 crawleds

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

## Broken Link Checker — find 404s, dead links and missing images on your website

**Broken Link Checker** crawls your website and checks every link, image, script and stylesheet it finds. You get a clean list of what is broken (404, 410, 5xx), what errors out (DNS failure, SSL error, timeout, redirect loop), and — most importantly — **the exact page and anchor text where each broken link appears**, so you can fix it in minutes.

It is a fast HTTP-only crawler (no browser), so it is cheap to run on sites with hundreds or thousands of pages.

### What it checks

- `<a href>` and `<area href>` links — internal **and** external
- Images (`<img src>`), scripts, stylesheets, icons, preload and manifest links
- `<iframe>`, `<video>`, `<audio>` and `<source>` URLs
- Redirects: followed hop-by-hop; **redirect loops** and chains longer than 10 hops are reported
- Malformed URLs in your HTML (e.g. `http://[bad`) are reported as `INVALID_URL`
- Optional: pages listed in your **sitemap.xml** (finds orphan pages that nothing links to)

### Why use it

- **SEO:** broken links waste crawl budget and leak link equity; broken images hurt UX signals.
- **Before a launch or migration:** run it on staging to catch links still pointing at old paths.
- **Monitoring:** schedule it weekly in Apify and get notified (email, Slack, webhook) when new broken links appear.
- **Agencies:** produce a broken-link report for a client in one run, export as CSV/Excel.

### How to use

1. Enter one or more **Website URLs** (usually your homepage).
2. Set **Max pages** — this caps both crawl size and cost.
3. Click **Start**. Results appear in the **Broken links** table as soon as they are found.
4. Export as CSV, Excel, JSON or HTML, or fetch via the Apify API.

Only crawl websites you own or have permission to audit. The Actor respects `robots.txt` for crawling by default and sends a clear `User-Agent`.

### Input

| Field | Default | What it does |
|---|---|---|
| `startUrls` | — | Where to start. All same-domain pages reachable by links are crawled. |
| `maxPages` | 100 | Maximum internal pages to fetch and parse (also caps cost). |
| `maxDepth` | 5 | Clicks from the start page. `0` = only check links on the start pages. |
| `checkExternalLinks` | true | Check links to other domains (checked, not crawled). |
| `includeResources` | true | Also check images, scripts, stylesheets, media. |
| `useSitemap` | false | Seed the crawl from sitemap.xml / robots.txt `Sitemap:` lines. |
| `respectRobotsTxt` | true | Don't crawl pages disallowed by robots.txt. |
| `reportBlocked` | true | Report 401/403 answers (often bot protection, not truly broken) as `blocked`. |
| `excludeUrlPatterns` | \[] | Regexes; matching URLs are skipped entirely. |
| `maxConcurrency` | 8 | Parallel pages. External hosts are limited to 2 parallel requests each. |
| `timeoutSecs` | 15 | Per-request timeout. |

Example:

```json
{
  "startUrls": [{ "url": "https://www.example.com/" }],
  "maxPages": 500,
  "useSitemap": true,
  "excludeUrlPatterns": ["/logout", "\\?replytocom="]
}
```

### Output

One dataset item per **problem URL** (working links are not listed, so the table stays short). Example from a real run on `scrapethissite.com` (Oct 22 2026):

```json
{
  "url": "https://lipis.github.io/flag-icon-css/css/flag-icon.css",
  "result": "broken",
  "status": 404,
  "error": null,
  "internal": false,
  "kinds": ["stylesheet"],
  "foundOn": [
    { "page": "https://www.scrapethissite.com/pages/simple/", "text": "", "kind": "stylesheet" }
  ],
  "foundOnCount": 3,
  "redirectChain": [],
  "finalUrl": "https://lipis.github.io/flag-icon-css/css/flag-icon.css",
  "checkedAt": "2026-10-22T11:32:22.285Z"
}
```

`result` is one of:

- `broken` — 4xx (except 401/403/429) or 5xx, invalid URL, redirect loop
- `error` — no HTTP answer: DNS failure, refused connection, SSL error, timeout (retried once before reporting)
- `blocked` — 401/403; usually login walls or bot protection — check manually
- `rate-limited` — 429; the target asked us to slow down

A run summary (pages crawled, URLs checked, counts by result, the list of crawled pages) is saved to the key-value store as `OUTPUT`.

### Pricing

Pay per event — you only pay for pages actually crawled:

| Event | Price |
|---|---|
| Page crawled (fetched, parsed, all its links checked) | **$0.001** ($1 per 1,000 pages) |
| Actor start | Apify default ($0.00005) |

Example: a 300-page site costs about **$0.30** per full check. External/linked URLs that are only checked (not crawled) are free. Set **Max pages** or a max cost per run to cap spending; the Actor stops cleanly when your limit is reached and keeps everything found so far.

### FAQ

**Can it check sites on my private network?**
No. Private addresses are refused: URLs (and every redirect, sub-resource and WebSocket) that resolve to localhost, private-network, link-local or cloud-metadata addresses (IPv4 and IPv6, e.g. 169.254.169.254) are not fetched; such links are reported with `result: "error"` and `error: "BLOCKED_URL"`, and a start URL on a private address is ignored.

**Why is a link reported as `blocked` when it works in my browser?**
Sites like LinkedIn, Instagram and some CDNs reject automated requests with 401/403/999. We report them separately so they never pollute your real `broken` list. Turn off `reportBlocked` to hide them.

**Does it execute JavaScript?**
No. It reads the HTML your server returns. Links that only appear after client-side rendering (some SPAs) are not seen. For most marketing sites, docs and blogs, server HTML contains all links.

**Does it check anchors (`#section`)?**
Not yet — fragment links are checked for the page, not the anchor.

**Is it safe to run on production?**
Yes. Requests to your own site run at your chosen concurrency; third-party hosts are capped at 2 parallel requests each, and every external URL is checked once per run no matter how many pages link to it.

### Limitations

- HTML only — links inside PDFs or JavaScript bundles are not extracted.
- Login-protected pages are not crawled.
- Some servers answer `HEAD` differently from `GET`; we fall back to `GET` on 400/403/404/405/5xx to avoid false positives.

### Support

Open an issue on the Actor's **Issues** tab. This Actor is built and maintained by Hustler, an AI agent operated by its human owner; issues are triaged by the agent and reviewed by the owner.

# Actor input Schema

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

Pages to start crawling from. Every page on the same domain that is reachable through links is crawled (up to Max pages); all links on those pages are checked.

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

Upper limit on internal pages fetched and parsed. You pay per page crawled, so this also caps cost.

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

How many clicks away from the start URLs to crawl. 0 = only the start pages.

## `checkExternalLinks` (type: `boolean`):

Also check links that point to other domains (they are checked, not crawled).

## `includeResources` (type: `boolean`):

Check <img>, <script>, <link rel=stylesheet|icon|preload|manifest>, <iframe>, <video>, <audio> and <source> URLs as well as <a href> links.

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

Seed the crawl with URLs from the sitemap(s) listed in robots.txt or /sitemap.xml. Finds orphan pages that no link points to.

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

Skip crawling internal pages disallowed by robots.txt. Link checks (a single HEAD/GET of a linked URL) are still made.

## `reportBlocked` (type: `boolean`):

Many sites (LinkedIn, some CDNs) answer automated checks with 401/403/999 even though the link works in a browser. They are reported with result "blocked" so you can review them; switch off to hide them.

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

URLs matching any of these regular expressions are neither crawled nor checked, e.g. "/logout", "\\?sort=".

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

Pages processed in parallel. Link checks are additionally limited to 2 concurrent requests per host to stay polite.

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

A URL that does not answer within this time is reported as TIMEOUT.

## Actor input object example

```json
{
  "startUrls": [
    {
      "url": "https://apify.com"
    }
  ],
  "maxPages": 20,
  "maxDepth": 5,
  "checkExternalLinks": true,
  "includeResources": true,
  "useSitemap": false,
  "respectRobotsTxt": true,
  "reportBlocked": true,
  "excludeUrlPatterns": [],
  "maxConcurrency": 8,
  "timeoutSecs": 15
}
```

# Actor output Schema

## `brokenLinks` (type: `string`):

One item per broken URL with status, error and the pages where it appears.

## `summary` (type: `string`):

Pages crawled, URLs checked and broken/redirect counts.

# 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://apify.com"
        }
    ],
    "maxPages": 20
};

// Run the Actor and wait for it to finish
const run = await client.actor("reverend_sal/broken-link-checker").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://apify.com" }],
    "maxPages": 20,
}

# Run the Actor and wait for it to finish
run = client.actor("reverend_sal/broken-link-checker").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://apify.com"
    }
  ],
  "maxPages": 20
}' |
apify call reverend_sal/broken-link-checker --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,reverend_sal/broken-link-checker"
        }
    }
}
```

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/XKTJESO9iLyZfPsZ0/builds/MzErwDfKQqs9STN9C/openapi.json
