Do these 3 things before closing this tab:
1Fix the driver behind crashes, sound loss and screen glitches2Clear out junk files and repair common Windows errors3Scan for outdated or missing drivers - takes under a minuteSome links on this page are affiliate links: if you buy through them we may earn a commission, at no extra cost to you.
Use curl -I https://example.com (or the equivalent curl --head https://example.com) to send an HTTP HEAD request. cURL prints the response headers and does not download the response body. The option is documented in the curl manual.
The basic HEAD command
Run this in a terminal:
curl -I https://example.com
The long form is identical:
curl --head https://example.com
A typical response might look like this:
HTTP/2 200
content-type: text/html
content-length: 1256
cache-control: max-age=3600
last-modified: Tue, 29 Sep 2026 10:15:00 GMT
The exact fields depend on the server. You receive metadata such as the status code, media type, advertised size, cache policy and modification validators, but not the HTML, image or other representation itself.
| # | Preview | Product | Price | |
|---|---|---|---|---|
| 1 |
|
Dan Gookin's Guide to Curl Programming | $11.95 | Buy on Amazon |
| 2 |
|
Curly Girl: The Handbook | $8.19 | Buy on Amazon |
| 3 |
|
The C Programming Language | $10.01 | Buy on Amazon |
| 4 |
|
Curl by Example | $0.99 | Buy on Amazon |
| 5 |
|
A Practical Guide to Curl (Programming Series) | $24.99 | Buy on Amazon |
What HTTP HEAD actually does
HTTP semantics define HEAD as identical to GET except that the server must not send content. In practice, the client asks the server to process the same target as a GET while returning headers only. HEAD is safe and idempotent, and it can be cached.
Servers are expected to send the header fields that a corresponding GET would send. That is not an absolute byte-for-byte preview, however. A server may omit fields whose values can be determined only while generating the content, so HEAD metadata can differ slightly from a later GET.
#1 Best Overall
-I versus -i and -D
| Command | HTTP method | Response body | Header handling |
|---|---|---|---|
curl -I URL or curl --head URL |
HEAD | Not transferred | Headers printed |
curl -i URL |
Normally GET | Transferred and printed | Headers printed before the body |
curl -D headers.txt URL |
Normally GET unless another method is selected | Transferred | Headers saved to headers.txt |
The distinction matters: -i changes output formatting for an ordinary transfer; it does not send HEAD. Use -I when avoiding the body is the goal.
Inspect status, type and size before downloading
Check whether a URL responds
curl -I https://example.com/health
Read the first line for the HTTP status. A 2xx response generally indicates success, 3xx indicates redirection, 4xx indicates a client or access problem, and 5xx indicates a server-side failure. This is a diagnostic signal, not a guarantee that the eventual GET will succeed.
Read the advertised media type
curl -I https://example.com/assets/archive.zip
Look for Content-Type. It can reveal whether the endpoint presents an archive, image, document or HTML response before you transfer it. Do not assume the value is trustworthy for security decisions; validate downloaded data when that matters.
Check a possible file size
curl -I https://example.com/assets/archive.zip
If the server supplies Content-Length, it gives the advertised representation size in bytes. This is useful before a large GET, but it may be absent or may not describe the final transfer when compression, dynamic generation or streaming is involved.
Review cache and modification metadata
curl -I https://example.com/app.js
Inspect Cache-Control, ETag, Last-Modified, Expires and related fields to understand caching and conditional requests. A validator such as an ETag is not necessarily a timestamp and should be treated as an opaque value.
Redirects, output and useful flags
See redirect responses
curl -I https://example.com/old-path
Without extra options, cURL shows the first response, which may be a 301, 302, 307 or 308 and a Location header. Follow redirects when you want to inspect the final destination:
Rank #2
curl -I -L https://example.com/old-path
With -L, cURL can print a header block for each hop. Review all blocks rather than assuming the first status is the final result.
PC Slower Than It Used to Be?
A free scan shows the junk files, broken settings and background clutter dragging Windows down - then fixes them in one click.Free scan · Windows 10 & 11Outdated Drivers Are Slowing You Down
One free scan finds every outdated or missing driver and matches the right update for your exact hardware.Free scan · exact hardware matchMake failures visible in scripts
curl --fail --silent --show-error --head https://example.com
--fail makes HTTP errors produce a nonzero exit status, while --silent --show-error suppresses progress noise but keeps error messages. For a timeout bound:
curl --fail --silent --show-error --head --connect-timeout 10 --max-time 30 https://example.com
--connect-timeout limits connection establishment; --max-time limits the entire operation.
Print only selected information
curl -sS -o /dev/null -w 'status=%{http_code} type=%{content_type} size=%{size_download}n' -I https://example.com
This is convenient in shell scripts. Because HEAD has no body, size_download describes bytes received during the request, not necessarily the resource’s size. Prefer the server’s Content-Length header when you need an advertised representation length.
Save headers
curl --head https://example.com -D headers.txt
For a HEAD request, the same headers are printed unless you redirect standard output. To save them without displaying them:
curl --head https://example.com -o /dev/null -D headers.txt
Headers, authentication and request variants
Send a specific request header
curl -I -H 'Accept: application/json' https://api.example.com/resource
Some servers vary their response by Accept, language or user agent. Add only headers you are authorized to use, and remember that a HEAD response can still be blocked by authentication or bot protection.
Rank #3
Authenticate safely
curl -I -H "Authorization: Bearer $TOKEN" https://api.example.com/resource
Keeping the token in an environment variable avoids placing it directly in shell history. Do not paste credentials into shared logs or support tickets.
Use a different method only when the API requires it
curl -X HEAD https://example.com
-X HEAD explicitly changes the method, but -I is clearer for a header-only request and gives cURL the appropriate body-handling behavior. Use an explicit method only when you understand the endpoint’s requirements.
HEAD in Python and Node.js
Python with Requests
import requests
url = "https://example.com"
r = requests.head(url, allow_redirects=True, timeout=30)
print(r.status_code)
print(r.headers)
print(r.headers.get("content-length"))
Redirect following is explicit here; choose False when you need to inspect the first response. A timeout prevents a stalled server from hanging the program indefinitely.
Quick wins for a faster PC:
Fix the driver behind crashes, sound loss and screen glitchesFind Drivers →Clear out junk files and repair common Windows errorsFree Scan →Node.js with the built-in fetch API
const response = await fetch('https://example.com', {
method: 'HEAD',
redirect: 'follow',
signal: AbortSignal.timeout(30000)
});
console.log(response.status);
console.log(Object.fromEntries(response.headers));
console.log(response.headers.get('content-length'));
Do not call response.text() or response.arrayBuffer() when you only need metadata. Those methods are for reading a body, and a compliant HEAD response has none.
When HEAD fails or gives surprising results
The server returns 405 Method Not Allowed
Some applications implement GET but not HEAD. If the endpoint documents no HEAD support, use a normal GET and include its headers:
curl -i https://example.com
This transfers the body, so discard it when appropriate:
Rank #4
curl -sS -D headers.txt -o /dev/null https://example.com
The server returns different headers than GET
Dynamic pages, compression, authentication and application middleware can produce different metadata. Treat HEAD as a lightweight probe, not a promise of exact GET output. If the size or type is critical, perform the GET or use the service’s documented metadata endpoint.
Free tools Windows power users keep installed
One-click scans. No signup required.
A redirect loop or unexpected host appears
Run without -L first and inspect each Location. Then follow redirects with a bounded timeout. Check whether HTTP-to-HTTPS upgrades, authentication redirects or canonical-host rules are involved.
A proxy, firewall or bot check blocks HEAD
Try the endpoint’s documented host, verify proxy settings, and compare an ordinary GET. A successful TCP connection does not prove that the application permits HEAD.
No Content-Length is present
This is normal for streamed or dynamically generated responses, and intermediaries can remove or change the field. Do not infer a zero-byte file from its absence.
Performance, reliability and scripting guidance
- HEAD usually saves bandwidth because no representation body is transferred, but server-side work can still resemble GET.
- Use connection and total-operation timeouts in automation.
- Record the URL, status, redirect chain and key headers when monitoring an endpoint.
- Respect rate limits; a HEAD request is not permission to probe an unrestricted list of hosts.
- For availability checks, combine status inspection with a small authenticated application check when a mere web-server response is insufficient.
- Expect caches and proxies to affect results. Compare timestamps, validators and the final URL before diagnosing a content change.
Or skip the browser setup
If your actual goal is obtaining a clean visual capture rather than inspecting HTTP metadata, ScreenshotNeo provides a website screenshot API and MCP server. One GET request returns a PNG, JPEG, WebP or PDF. Its capture flow accepts cookie-consent banners and removes more than 60 known consent platforms, newsletter popups and chat widgets before the shot; each step can be disabled.
For a direct capture:
curl -G "https://api.screenshotneo.com/v1/shot" -d access_key=YOUR_API_KEY --data-urlencode url=https://stripe.com -o shot.webp
See the ScreenshotNeo documentation for all options. Bot checks or CAPTCHAs, blank pages, timeouts, failed loads and cache hits are not billed, and response headers identify the page verdict and billing result. The MCP server exposes take_screenshot, get_page_info and capture_pdf for Claude, Cursor and other MCP clients.
There is a free allowance of 1,000 screenshots per month with no card. Paid plans start at $5 for 3,000 shots; every feature is available on every plan. Create a free ScreenshotNeo account.
Best Value
Frequently overlooked details
- A HEAD response has headers but no representation body; an empty body in a GET response is a different application result.
Content-Lengthis optional and is not always the eventual number of bytes delivered by a GET.-Iis an HTTP-method choice, while-iis an output choice.- Following redirects can expose several responses, so parse status and headers per hop.
Frequently Asked Questions
Can I use HEAD to test whether a file exists?
You can check the server’s status response, but permissions, routing and application logic mean a 200, 403 or 404 is not a universal proof of filesystem existence.
Does curl -I download any file data?
It does not download the response representation. It still transfers response headers and may perform substantial server-side processing.
Why is Content-Length missing from a HEAD response?
The response may be streamed or generated dynamically, or an intermediary may remove the field. HTTP does not require every response to include it.
Should I always follow redirects with -L?
No. Omit -L when auditing the first response or redirect policy; add it when you need metadata for the final URL.
The Bottom Line
For a header-only HTTP request, use curl -I URL or curl --head URL. Use -i only when you intentionally want a normal GET body together with its headers, and fall back to GET when the target does not support HEAD.
Quick Recap
Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.
What’s actually slowing this PC down?
Pick the symptom - the matching free tool is one click away.

