Check a website's HTTP status code with curl

Print just the HTTP status code (200, 404, 500…) of any URL using the curl tool built into Windows.

WindowscurlnetworktroubleshootingLow risk
Run: curl -s -o NUL -w "%{http_code}" https://example.com — it prints e.g. 200 for a healthy site.

01Command

Command
$ curl -s -o NUL -w "%{http_code}" https://example.com

02What it does

curl downloads the page, -o NUL throws the content away, and -w "%{http_code}" prints only the numeric status code: 200 OK, 301 redirect, 404 not found, 5xx server error. To see the full headers instead, run curl -I https://example.com. It's the fastest built-in way to check whether a site or API endpoint is alive.

03Risk

RiskLow risk
RequirementsWindows 10 (1803+) and 11 include curl.exe by default
!Warning: Some sites block command-line requests; if you get a 403, add a browser User-Agent: -A "Mozilla/5.0"

04Undo

✓No undo needed — this command does not change persistent state.

05Sources

  • curl.exe - Transfer data from or to a server
    SS64.com · technical · 2026-09-17
    Evidence: Windows curl reference documenting --head / -I (headers only) and write-out options; headers-only requests show the HTTP status line such as HTTP/1.1 200 OK.
  • curl man page
    curl.se · vendor-doc · 2026-09-17
    Evidence: Documents -w/--write-out with variables such as %{http_code} (the HTTP response code) and -s/--silent for quiet mode; -o writes the body to a file (NUL discards it).

Last verified: 2026-09-19 · Category: Network

06Related solutions