COMMAND

curlTransfer data and inspect HTTP from the command line

curl transfers data to and from a server and is built into Windows 10 and 11. For diagnostics it is the fastest way to see raw HTTP: curl -I shows response headers, -L follows redirects, -v shows the TLS handshake and request, and -d sends a request body. It removes the browser from the picture when testing a URL or API.

BlackhawkHub Editorial · Updated

Purpose

curl moves data over HTTP, HTTPS, FTP and many other protocols. For troubleshooting the web it is invaluable because it shows exactly what the server returns, with no cache, cookies or JavaScript in the way. When a page behaves oddly, curl tells you what is actually on the wire.

Inspect response headers and status

cmd
curl -I https://example.com/
text
HTTP/2 200
content-type: text/html; charset=UTF-8
cache-control: max-age=3600

The status line tells you 200, 404, 301 and so on directly.

Follow redirects

cmd
curl -IL http://example.com/

Prints every hop, revealing redirect chains and loops between 301 and 302 responses.

See the full exchange and TLS

cmd
curl -v https://example.com/ -o NUL

-v shows the DNS resolution, the TLS version and certificate (TLS vs SSL), the request headers sent and the response headers received. -o NUL discards the body so the headers are readable.

Test an API

cmd
curl -i -X POST https://api.example.com/login ^
  -H "Content-Type: application/json" ^
  -d "{\"user\":\"alice\",\"pass\":\"secret\"}"

-i includes the response headers with the body. Use -d @file.json to avoid quote-escaping. Add -H "Authorization: Bearer TOKEN" for authenticated calls; a 401 means the token was missing or rejected.

Download a file

cmd
curl -L -o installer.zip https://example.com/download/installer.zip

-O keeps the remote filename; -C - resumes a partial download.

Useful options

OptionEffect
-IHEAD request: headers only
-iInclude response headers with the body
-LFollow redirects
-vVerbose: handshake, request, response
-o file / -OSave to a named / remote-named file
-HAdd a request header
-dSend a body (implies POST)
-kSkip TLS certificate verification (diagnostics only)
-ASet the User-Agent
-xUse a proxy

Common mistakes

  • PowerShell alias confusion. Plain curl in PowerShell is Invoke-WebRequest; its parameters differ. Use curl.exe for real curl.
  • Quote escaping on Windows. cmd and PowerShell handle quotes differently; put JSON in a file with -d @file.json to avoid the problem.
  • -k in production scripts. Skipping certificate checks defeats TLS; use it only to diagnose a certificate problem, never as a permanent workaround.
  • Testing HTTPS behaviour with -I on servers that treat HEAD differently from GET; use -i with a GET if results look off.

Frequently asked questions

Is curl really built into Windows?

Yes. curl.exe ships with Windows 10 (from version 1803) and Windows 11. Note that in PowerShell, curl without .exe is an alias for Invoke-WebRequest, which takes different arguments; use curl.exe to get the real curl.

How do I see just the HTTP status and headers?

curl -I https://example.com/ sends a HEAD request and prints the response headers, including the status line. Add -L to follow redirects and see the final one.

How do I send JSON to an API?

curl -X POST https://api.example.com/items -H "Content-Type: application/json" -d "{\"name\":\"test\"}". On Windows the inner quotes need escaping; a file is easier: -d @body.json.

Sources