All posts

How to Monitor Broken Links Automatically (Daily Checks + Email & Slack Alerts)

How to monitor broken links automatically: pick what to watch, run daily checks with a free script or a hosted monitor, and get email or Slack alerts.

Published 10 min read

To monitor broken links automatically, you need three things: a list of the URLs that matter, something that checks each one on a schedule, and an alert that reaches you when a check fails. With those in place, a dead link gets fixed the day it breaks, not the day a customer mentions it.

This guide covers all three. You'll get a free do-it-yourself setup with curl, cron and a Slack webhook, then the hosted option, and finally what to do when an alert fires. If you only need a one-time audit, start with How to Find and Fix Broken Links on Your Website and come back when you want it to keep running.

Why one-time checks aren't enough

Every broken link checker gives you a snapshot. The snapshot is accurate on the day you run it and starts going stale the next morning, because the web keeps changing after you stop looking.

The numbers on this are blunt. Pew Research Center checked nearly a million webpages in 2023 and found that 38% of the pages that existed in 2013 were no longer accessible. Even among pages from 2021, about one in five had disappeared within two years. The same study found at least one broken link on 23% of news pages and 21% of government pages.

None of that decay needs you to change anything. A partner moves its docs, a merchant deletes a product, a domain you cited expires. Monitoring covers the gap between the audits you remember to run.

What to monitor

You don't need to monitor every URL on the internet that you've ever linked to. You need to monitor the links whose failure costs you something. Start with this list and add as you go:

Link typeWhy it mattersWhere to find them
Your own important pagesIf your pricing, signup or top landing pages break, nothing else mattersYour sitemap, or a short hand-picked list
Checkout, signup and login linksA broken one blocks revenue directlyYour nav, CTAs and email templates
Affiliate and partner linksDead ones earn nothing on your highest-traffic pagesYour cloaking plugin, or a crawl (how-to)
Outbound links in top contentCited sources, tools and resources in posts that rankYour top pages by traffic
Documentation and help center linksBroken docs links create support ticketsYour docs sitemap
Links in emails and PDFs you can't edit laterOnce sent, the only fix is on the destination sideYour email templates, lead magnets, slide decks

The last row is easy to forget. A link in a newsletter that went to 20,000 people can't be updated, but if the destination is your own page, you can make sure it keeps resolving or redirects somewhere useful.

How often to check

For most monitoring, once a day is the right rhythm. It's frequent enough that a break costs you a day at most, and gentle enough that you aren't hammering anyone's server. Checking third-party links every few minutes gets you rate-limited or blocked. And unlike your own server's uptime, a link break rarely needs a response within minutes.

There are exceptions both ways. A small brochure site that rarely changes can get by on weekly or monthly checks. A store whose catalogue changes daily might add a check right after each import. The full breakdown by site type is in How Often Should You Check for Broken Links?

Option A: a do-it-yourself monitor with curl, cron and Slack

Good for: developers, small link lists, and anyone who wants to see how it works before paying for anything.

This setup runs on any Linux or macOS machine that's on all the time, such as a server or VPS. Total setup time is about 15 minutes.

1. Make a list of URLs

Create links.txt with one URL per line. Lines starting with # are ignored, so you can group them:

# Money pages
https://example.com/pricing
https://example.com/signup
 
# Affiliate links
https://example.com/go/favorite-tool
https://partner.example.net/offer?ref=123

If you want to monitor every page on your site, you can generate the list from your sitemap. See How to Check Every URL in Your Sitemap for 404 Errors for a one-liner.

2. Create a Slack incoming webhook

Slack's incoming webhooks give you a URL that posts a message to one channel. In short: create a Slack app, turn on Incoming Webhooks, click Add New Webhook to Workspace, and pick a channel like #website-alerts. You'll get a URL that starts with https://hooks.slack.com/services/.

Treat that URL like a password. Anyone who has it can post to your channel, and Slack revokes webhook URLs it finds leaked in public places.

3. Save the check script

#!/usr/bin/env bash
# check-links.sh: check every URL in links.txt and post failures to Slack.
# Usage: SLACK_WEBHOOK_URL=https://hooks.slack.com/services/... ./check-links.sh links.txt
 
LIST="${1:-links.txt}"
FAILED=()
 
while IFS= read -r url; do
  [[ -z "$url" || "$url" == \#* ]] && continue          # skip blank lines and comments
  code=$(curl -o /dev/null -s -L --max-time 15 -A "Mozilla/5.0 (link-check)" \
         -w "%{http_code}" "$url")
  # curl prints 000 when there is no HTTP response at all (timeout, DNS failure, refused)
  if [[ "$code" == "000" || "$code" -ge 400 ]]; then
    FAILED+=("$code $url")
  fi
  sleep 1                                                # be polite to the servers you check
done < "$LIST"
 
if (( ${#FAILED[@]} > 0 )); then
  text=$(printf '%s\n' "Broken links found (${#FAILED[@]}):" "${FAILED[@]}")
  if [[ -n "$SLACK_WEBHOOK_URL" ]]; then
    payload=$(python3 -c 'import json,sys; print(json.dumps({"text": sys.stdin.read()}))' <<< "$text")
    curl -s -X POST -H 'Content-type: application/json' --data "$payload" "$SLACK_WEBHOOK_URL" > /dev/null
  fi
  echo "$text"
  exit 1
fi
echo "All links OK"

Make it executable with chmod +x check-links.sh and run it once by hand to test. Leave SLACK_WEBHOOK_URL unset the first time, and it just prints results:

$ ./check-links.sh links.txt
Broken links found (3):
404 https://example.com/old-pricing
000 https://expired-domain-example.com/
503 https://partner.example.net/offer?ref=123

What the script does:

  • -L follows redirects, so a 301 to a working page counts as fine and you see the final status.
  • --max-time 15 gives each URL 15 seconds before it's marked as failed.
  • 000 is curl's way of saying no HTTP response came back. That's usually a DNS failure (the domain is gone), a refused connection, or a timeout.
  • Anything 400 or above counts as a failure. That covers 404, 410, and server errors like 500 and 503.

4. Schedule it with cron

Open your crontab with crontab -e and add a line to run it every morning at 7:00:

0 7 * * * SLACK_WEBHOOK_URL=https://hooks.slack.com/services/XXX/YYY/ZZZ /home/you/check-links.sh /home/you/links.txt >> /home/you/check-links.log 2>&1

That's a working monitor. Every morning, broken links land in Slack with their status codes.

Where the DIY version falls short

It's worth knowing the limits before you depend on it:

  • It alerts on every failure, every day. A link that's been broken for a week shows up seven times, and a one-off 503 from a server having a bad minute looks the same as a real 404. Fixing that means storing past results and comparing runs.
  • It keeps no history. You can't see that a link fails every Tuesday, or when exactly it started failing.
  • It's slow for big lists. One URL per second is polite, but 5,000 links take well over an hour. Running checks in parallel helps, but then you need per-domain rate limiting so you don't hit one site with 50 requests at once.
  • It depends on one machine. If the server reboots, the cron job breaks, or the disk fills up, the monitor stops and nothing tells you. A monitor that fails silently is worse than none, because you think you're covered.
  • Some sites block it. Requests from a datacenter IP can get a 403 or 429 from bot protection even when the page works fine in a browser.

For a few dozen links on a server you already run, none of this matters much. (If you're on WordPress and hoped a plugin would cover all this, see Broken Link Checker plugin alternatives for the trade-offs of running checks on your own server.) Once the list grows, or other people depend on the alerts, it starts to.

Good for: content and SEO teams, affiliate publishers, agencies, and anyone who doesn't want to maintain a script.

A hosted monitor does the same job as the script. The difference is that the scheduling, history, alert routing and infrastructure are someone else's problem.

Brokenlink works like this:

  1. Add your links. Paste a list of URLs, or connect your sitemap.xml to import every page on your site in one step. Group links into projects (one per site, client or campaign) and tag them with labels like "affiliate", "docs" or "checkout".
  2. Every link is rechecked every 24 hours. Nothing to schedule, and no server of your own to keep running.
  3. Get alerted when a check fails. Alerts go to email, Slack or both, and include the exact URL and error code. Failures include 4xx and 5xx responses, timeouts and DNS failures.
  4. Get regular summaries. Status reports go out daily, weekly or monthly by email or Slack, so you see the overall health of your links even when nothing breaks.
  5. Look back. Each link keeps 30 days of check history, so a link that keeps failing on and off is easy to spot.

Every plan includes every feature. The price depends only on how many links you monitor, starting at $9/month for 1,000 links (see all plans).

DIY vs hosted at a glance

DIY script (Option A)Hosted monitor (Option B)
CostFree, plus a server you already runMonthly subscription
SetupAbout 15 minutes, needs the command lineA few minutes, no code
ScheduleWhatever you put in cronEvery 24 hours, handled for you
AlertsSlack via webhook; email takes extra workEmail and Slack built in
Check historyNone unless you build it30 days per link
Status reportsBuild it yourselfDaily, weekly or monthly
Many sites or clientsSeparate lists and scriptsProjects and labels
If the machine diesMonitoring stops without telling youNot your machine

What to do when an alert fires

An alert is only useful if you know what to do with it. Work through it like this:

  1. Read the status code first.
    • 404 or 410: the page is gone. This is a real break.
    • 500, 502, 503 once: possibly temporary. Note it and wait for the next check.
    • Timeout or DNS failure: the server isn't answering, or the domain no longer resolves. If the domain has expired, it isn't coming back.
    • 403 or 429: often bot protection or rate limiting. Open the link in a private browser window before changing anything.
  2. Confirm in a browser. It takes ten seconds and saves you from "fixing" a link that works.
  3. Find where the link lives. For your own pages, the alert URL is the page. For outbound links, search your CMS for the URL, or keep a note of the source page when you add the link to your monitor.
  4. Fix it. Update the link if the page moved, replace it if there's a good substitute, remove it if there isn't. If the broken page is your own, add a 301 redirect from the old URL so every other link to it keeps working.
  5. Watch the next check. The link should come back healthy. If a link keeps going up and down, the destination is unreliable, and it's worth replacing even while it technically works.

Keep alerts from becoming noise

Monitoring fails quietly when people stop reading the alerts. A few habits keep the signal clean:

  • Send alerts to a dedicated channel, like #website-alerts, not #general, so they don't get buried.
  • Name an owner for each project. "Someone will fix it" means nobody does.
  • Fix or remove known-bad links promptly. A link that's been broken for three weeks trains everyone to ignore the channel.
  • Use reports for the big picture and alerts for action. A weekly summary to the team plus instant alerts to the person who fixes things works well.

The short version

  • Monitoring broken links automatically means a list of URLs, a scheduled check, and an alert that reaches a person.
  • Watch the links that cost you when they fail: money pages, checkout and signup, affiliate links, top-content outbound links, and docs.
  • Once a day is the right rhythm for most sites.
  • The free curl + cron + Slack webhook setup above works for small lists. It has no history, repeats alerts, and stops silently if the machine does.
  • A hosted monitor like Brokenlink rechecks every link every 24 hours, alerts you by email or Slack with the exact URL and error code, and keeps 30 days of history. There's a 14-day free trial with no card required.