Broken links waste crawl budget, lose visitors and make a site look abandoned. Here are free ways to find them on one page or a whole site, and which results to double-check before you delete anything.
wget --spider -r, lychee or linkchecker, and look at the Not found (404) list in Google Search Console. Re-check anything that says 403, 405 or 429 in a browser before you call it broken.This pulls every absolute http(s) link out of the page HTML, requests each one (following redirects, 10 second timeout) and prints the ones that answer 400 or higher, or not at all (000):
URL=https://example.com/
curl -s "$URL" | grep -oE 'href="https?://[^"]+"' | cut -d'"' -f2 | sort -u |
while read -r u; do
code=$(curl -s -o /dev/null -L -m 10 -w '%{http_code}' "$u")
if [ "$code" -ge 400 ] || [ "$code" = 000 ]; then echo "$code $u"; fi
done
It skips relative links such as /about. If you need those too, use one of the tools in step 3, which resolve them against the page URL.
wget --spider -r -l 3 -nd -nv -w 0.5 -o links.log https://example.com/
sed -n '/broken link/,$p' links.log # wget lists broken URLs at the end of the log
-l 3 limits the crawl depth and -w 0.5 waits half a second between requests, so you don't hammer your own server. Spider mode does not keep the downloaded files.
lychee https://example.com/ # fast Rust checker, also reads local files and Markdown
linkchecker https://example.com/ # Python crawler, follows the whole site by default
SiteDoctor is a remote MCP server (Streamable HTTP, no install) at https://manhourplan.com/doctor/mcp. Its check_broken_links tool reads the <a href> links on a page, tests up to 50 of them (default 25) with HEAD, retries with GET when a server answers 403, 405 or 501, follows redirects, and returns every link that answered 4xx/5xx or could not be reached, with its status. It costs 2 credits per call. It checks one page per call and works from the HTML, so the limits above about JavaScript links, soft 404s and anchors apply to it too.
# Claude Code
claude mcp add --transport http sitedoctor https://manhourplan.com/doctor/mcp
# then ask: "get a free SiteDoctor key and check https://example.com/ for broken links"
# raw JSON-RPC tools/call (after initialize + register_free_key, see the SiteDoctor page)
{"jsonrpc":"2.0","id":3,"method":"tools/call","params":{"name":"check_broken_links",
"arguments":{"url":"https://example.com/","max_links":50,"api_key":"YOUR_KEY"}}}
Result shape:
{"url": "https://example.com/",
"links": {"checked": 50, "broken": [{"url": "https://example.com/old-page", "status": 404}], "skipped": false},
"issues": [{"cat": "links", "sev": "high", "msg": "1 broken link(s) found in sample of 50"}]}
register_free_key gives 25 free credits with no signup or card. After that, card packs: $9 for 1,000 credits, $29 for 10,000, $99 for 100,000; credits never expire. scan_website (3 credits) adds SEO, security headers, SSL and speed to the same link check.The free web scan on the SiteDoctor page (5 per day) shows a score and the top issues; the full broken-link list comes from the MCP tools.
Pull the links out of the page HTML and request each one: the curl loop in this guide prints every link that answers 4xx, 5xx or not at all. The W3C Link Checker (validator.w3.org/checklink) does the same in a browser.
Crawl it. wget --spider -r lists broken links at the end of its log, and command-line checkers such as lychee or LinkChecker crawl and report too. Google Search Console shows internal URLs that returned 404 under Indexing, Pages, Not found (404).
Some servers reject HEAD requests or automated clients and answer 403, 405, 429 or a custom code even though the page opens in a browser. Re-test those with GET and a normal browser before you remove them. The opposite also happens: a soft 404 page answers 200.
Yes. SiteDoctor is a remote MCP server at https://manhourplan.com/doctor/mcp. Its check_broken_links tool tests up to 50 links on a page and returns each broken URL with its HTTP status for 2 credits. register_free_key gives 25 free credits; card packs start at $9 for 1,000 credits.