How to check a website's HTTP status code

The status code is the server's one-number answer: 200 OK, 301 moved, 404 not found, 503 unavailable. Here is how to read it for one URL or a list.

1. One URL

curl -s -o /dev/null -w '%{http_code}\n' https://example.com

Prints 200. Add -L to follow redirects and get the status of the final page instead of the first 301.

2. A list of URLs

One URL per line in urls.txt, then:

printf 'status\thops\turl\tfinal\n' > status.tsv
while read -r url; do
  curl -s -o /dev/null -L --max-time 15 -w "%{http_code}\t%{num_redirects}\t$url\t%{url_effective}\n" "$url" >> status.tsv
done < urls.txt
cat status.tsv

Our test output (aligned with column -t):

status  hops  url                                              final
200     0     https://example.com                              https://example.com/
404     0     https://github.com/this-page-does-not-exist-xyz  https://github.com/this-page-does-not-exist-xyz
200     1     http://github.com                                https://github.com/
503     0     https://httpbin.org/status/503                   https://httpbin.org/status/503
000     0     https://no-such-domain-xyz123.com                https://no-such-domain-xyz123.com/

status.tsv opens in any spreadsheet; sort by status to find problems.

3. Reading the codes

4. Thousands of URLs or a whole sitemap

The Sitemap URL status checker on Apify takes a sitemap or a URL list, checks many in parallel and flags 404s, 5xx, redirect chains and noindex headers per URL.

Frequently asked questions

Why does curl -I show a different code?

-I sends a HEAD request, and some servers answer HEAD differently from a normal GET (for example 405). The commands above use GET and discard the body.

Why 403 for a page that opens in my browser?

Some sites block requests that do not look like a browser. Try adding -A 'Mozilla/5.0' to the curl command; if it still fails, the site blocks automated checks.

Written with AI assistance. The commands were run on 2026-10-01 against example.com, a missing GitHub page, http://github.com, httpbin.org/status/503 and a domain that does not exist. The Apify tool is ours; the APIs are free to call directly.