Skip to content
Proxy fundamentals

curl vs Wget: which command should you use?

curl is a request workbench; Wget is a download worker. Compare real defaults, proxy behavior, resumes, recursion, retries, and local measurements.

On this page 12 sections
  1. The decision in ten seconds
  2. What we measured locally
  3. The default request is different
  4. curl is the better request workbench
  5. Wget is the better download worker
  6. Redirects, retries, and HTTP errors
  7. Proxy behavior and the CONNECT boundary
  8. Resuming a broken download
  9. Uploads, forms, and APIs
  10. Errors worth recognizing
  11. Practical recipes
  12. Method and limits

Use curl when the request itself is the work. Use Wget when a reliable download, resume, or small mirror is the work. Both speak HTTP and HTTPS, both can use an HTTP proxy, and either can fetch a single URL. Their defaults and their shape are different enough that swapping one for the other can change the request that reaches a site.

  • Choose curl for API calls, uploads, headers, and proxy diagnostics.
  • Choose Wget for unattended downloads, continuation, and bounded recursion.
  • Choose either for one URL, then set the flags that make redirects, retries, and TLS behavior explicit.

This comparison uses curl 8.23.0 and GNU Wget 1.25.0 on the same Mac, plus a local Python harness that recorded every request. It is about the command-line programs, not the libcurl API or a Python wrapper. If you are sending a few API calls, start with the curl proxy guide. If you are mirroring a directory of pages, read the Wget section before you add -r.

The decision in ten seconds

Job Better first choice Why Flag to remember
Inspect one request or response curl Verbose protocol tracing, header dumps, and structured write-out fields are the centre of its design -v, -D -, -w
Call a JSON or form API curl Methods, headers, bodies, multipart fields, and output streams are explicit -X, -H, -d, -F
Download one large file unattended Wget Retries, a local filename, and continuation fit its normal workflow -c, -O, -t
Resume a partial HTTP download Either Both can send a byte range; Wget makes continuation the shorter command Wget -c; curl -C -
Follow links and build a local copy Wget It parses HTML and CSS, follows links, respects robots.txt, and limits recursion -r -l1 --no-parent
Use an HTTP or SOCKS proxy curl Proxy negotiation and tunnel details are easy to see in a trace, and per-request settings are compact -x, --socks5-hostname
Check links without saving pages Wget --spider is a built-in no-download mode --spider

That table is a starting point, not a speed ranking. A fast transfer depends on the server, the network, TLS, storage, and the flags you choose. The only speed number in this article is the small local measurement below.

What we measured locally

On 21 October 2026, the machine used Homebrew curl 8.23.0 and Wget 1.25.0. A Python asyncio server on 127.0.0.1:28601 served a 512 MiB file of zero bytes. Each tool wrote to /dev/null. We alternated the order and ran seven transfers per tool. The harness recorded the child process wall time and user plus system CPU time. That is a reproducible command-line comparison, not a claim about internet throughput.

$ /opt/homebrew/opt/curl/bin/curl --version | sed -n '1,2p'
curl 8.23.0 (aarch64-apple-darwin25.6.0) libcurl/8.23.0 OpenSSL/4.0.3 zlib/1.2.12 brotli/1.2.0 zstd/1.5.7
Release-Date: 2026-10-14
$ /opt/homebrew/bin/wget --version | sed -n '1,2p'
GNU Wget 1.25.0 built on darwin24.1.0.
Seven 512 MiB loopback downloads per tool, 21 October 2026 Drawn from the table below.
Seven 512 MiB loopback downloads per tool, 21 October 2026. Bar chart of Median wall time (s), Median child CPU (s) by Tool.2 rows, drawn from the table that follows this chart.curl 8.23.0curl 8.23.0 · Median wall time (s): 0.0430.043curl 8.23.0 · Median child CPU (s): 0.0400.040Wget 1.25.0Wget 1.25.0 · Median wall time (s): 0.0370.037Wget 1.25.0 · Median child CPU (s): 0.0350.03500.010.020.030.040.05 secondsSeven 512 MiB loopback downloads per tool, 21 October 2026. Bar chart of Median wall time (s), Median child CPU (s) by Tool.2 rows, drawn from the table that follows this chart.curl 8.23.0curl 8.23.0 · Median wall time (s): 0.0430.043curl 8.23.0 · Median child CPU (s): 0.0400.040Wget 1.25.0Wget 1.25.0 · Median wall time (s): 0.0370.037Wget 1.25.0 · Median child CPU (s): 0.0350.03500.020.040.06 seconds
Tool Median wall time (s) Median child CPU (s) Median MiB/s All exit codes zero
curl 8.23.0 0.043 0.040 11862.9 yes
Wget 1.25.0 0.037 0.035 13770.7 yes

Wget was quicker in this run, but the difference is not a product promise. The transfer stayed on loopback, the payload was highly compressible in memory, and neither command wrote to disk. The useful result is that both completed every run and both consumed a small amount of CPU for this particular path. Test the route and payload you actually care about before choosing a tool for a throughput goal.

The default request is different

The local origin logged the complete request head. With no extra flags, curl sent a short HTTP/1.1 request with User-Agent: curl/8.23.0 and Accept: */*. Wget added User-Agent: Wget/1.25.0, Accept-Encoding: identity, and Connection: Keep-Alive. Wget’s extra headers are normal, but a brittle access rule or a cache key can make them matter.

Request detail curl 8.23.0 default Wget 1.25.0 default Why it matters
User-Agent curl/8.23.0 Wget/1.25.0 Some servers allow or deny clients by name. Identify your automation honestly.
Accept */* */* Neither asks for a particular media type unless you add one.
Accept-Encoding Absent by default identity Compression and content negotiation can change the body and the cache key.
Connection Absent in the captured request Keep-Alive Keep-alive is useful for a sequence, but a broken intermediary may behave differently.
Proxy request form Absolute-form for HTTP, CONNECT for HTTPS Absolute-form for HTTP, CONNECT for HTTPS The destination sees the same protocol shape, while the proxy sees different client headers.

The broader default request headers study measures more clients. When a target works in one command and fails in the other, inspect these defaults before changing the proxy. A curl -v trace or Wget’s --server-response output tells you what was actually sent.

curl is the better request workbench

curl treats a transfer as a request you can assemble. The URL is one argument; headers, method, body, proxy, TLS options, and output are separate options. That makes it a good fit for APIs and for diagnosing a proxy path.

# Inspect status, headers, and the first response bytes without saving a file.
curl --verbose --dump-header - --output /tmp/response.bin \
  --write-out '\nstatus=%{http_code} bytes=%{size_download} remote=%{remote_ip}\n' \
  https://api.example.test/items

--dump-header - writes response headers to standard output, while --write-out prints fields after the transfer. Keep the body in a file if you need to inspect it. This avoids the common mistake of piping a binary response into a terminal.

# A JSON request through an authenticated HTTP proxy.
curl --fail-with-body --silent --show-error \
  --proxy 'http://user:pass@gateway.example:8000' \
  -H 'Accept: application/json' \
  -H 'Content-Type: application/json' \
  --data '{"query":"proxy"}' \
  https://api.example.test/search

Do not place a real password in a shell history or a shared process list. Use a protected config file or an environment variable that your process manager supplies, and percent-encode reserved characters in a proxy URL. The environment-variable guide covers the precedence traps between http_proxy, HTTPS_PROXY, and NO_PROXY.

curl does not follow redirects unless you ask it to. Add --location, and set a maximum with --max-redirs when the URL is not fully under your control. It also does not treat an HTTP 404 or 500 as a process error unless you add --fail or --fail-with-body. That separation is useful for API clients that need to parse an error body.

Wget is the better download worker

Wget starts from a URL and assumes the goal is a local file. It chooses a filename, keeps a log, retries network failures, and has options for continuation and timestamps. It can run after you disconnect from a terminal, which is why it remains a sensible choice for a long download on a remote machine.

# Save the server's filename, continue a partial file, and retry transient failures.
wget --continue --tries=5 --timeout=20 \
  --output-file=download.log \
  https://downloads.example.test/archive.tar.zst

--continue asks Wget to resume an existing partial file when the server supports ranges. It is not a checksum. Verify a published digest after the transfer. If the server changed the object while you were away, a range can produce a file that is complete but wrong for your intended version.

Wget’s recursive mode is a different category of feature. It parses HTML and CSS, follows links, and builds a directory tree. The GNU manual warns that recursive retrieval can overload a remote server and fill your own disk. Bound it explicitly:

# Fetch one level under /docs/, staying on that host and directory tree.
wget --recursive --level=1 --no-parent --page-requisites \
  --wait=1 --random-wait --domains=docs.example.test \
  https://docs.example.test/docs/

--page-requisites is often enough for one page and its assets. Do not use --level=0 when you mean “one page”; in Wget, level zero means unlimited recursion. For a link check without downloading bodies, use --spider --server-response. Respect the target’s terms and robots policy, and keep the request rate low.

Redirects, retries, and HTTP errors

The two tools make different choices about unattended work. Wget follows HTTP redirects in its normal retrieval path and has retry controls for connection failures. curl exposes the redirect as a response unless --location is set, and its retry behavior is opt-in. That makes curl safer for a script where a changed redirect must be visible, while Wget is convenient for a download that should keep moving.

Situation curl Wget Safe response
HTTP 301 or 302 Returns the response unless -L is set Follows redirects by default Set a redirect limit and log the final URL for automation
HTTP 404 or 500 Exit remains zero unless --fail or --fail-with-body Reports a retrieval failure and uses a nonzero exit status Check both the status and the command exit status
Connection reset Returns an error such as 56, and retries only when configured Retries network errors according to its retry options Retry idempotent requests with a bounded count and backoff
HTTP 429 or 503 Use explicit retry policy; inspect Retry-After Use --retry-on-http-error=429,503 when appropriate Honor the server’s delay and stop on a permanent block

A retry is a policy decision, not a synonym for “the command failed.” Do not retry a POST unless the API documents it as safe or gives you an idempotency key. For proxy work, a 407 is authentication at the forward proxy; a 403 from the destination is a different layer. The 403 vs 407 vs 429 guide shows the CONNECT line that separates them.

Proxy behavior and the CONNECT boundary

For an HTTP URL, an HTTP proxy receives an absolute-form request such as GET http://host/path HTTP/1.1. For an HTTPS URL, curl and Wget first send CONNECT host:443; after the proxy returns 200 Connection established, TLS runs through the tunnel. A 407 or 403 on that CONNECT is a proxy response. A 403 with a server and cf-ray header after CONNECT is a destination response.

# Show the proxy handshake and preserve the target's response body.
curl --verbose --proxy 'http://demo:demo-pass@127.0.0.1:28602' \
  https://127.0.0.1:28601/hello

# Wget's equivalent proxy settings for one invocation.
https_proxy='http://demo:demo-pass@127.0.0.1:28602' \
  wget --server-response -O - https://127.0.0.1:28601/hello

Our local proxy logged both clients sending Basic Proxy-Authorization when the credentials were supplied. curl included Proxy-Connection: Keep-Alive; Wget sent that header plus its normal Connection: Keep-Alive. With no credentials, the harness returned 407 Proxy Authentication Required to both. The target server never saw those failed attempts. This is why a proxy guide should show the proxy log, not only the client error string.

curl also has an explicit SOCKS5 hostname mode:

# Resolve the target name at the SOCKS5 proxy, not on the client.
curl --socks5-hostname user:pass@gateway.example:1080 \
  https://target.example.test/

That distinction matters when DNS is restricted or when the proxy’s resolver has the location you need. Keep the proxy credentials out of examples that readers might paste into tickets. See HTTP CONNECT and proxy authentication for the protocol terms.

Resuming a broken download

Our harness served a deliberately broken 8 MiB object. It announced the full length, sent 3,000,000 bytes, and closed the connection. A second request with a range starting at byte 3,000,000 returned the remaining bytes as 206 Partial Content. Both tools emitted that range when invoked with continuation enabled.

# curl: -C - reads the existing output length and asks for the remainder.
curl --fail --location --continue-at - \
  --output broken.bin http://127.0.0.1:28601/broken

# Wget: -c is its continuation spelling.
wget --continue --output-document=broken.bin \
  http://127.0.0.1:28601/broken
Origin log, after the first 3,000,000 bytes were written:
GET /broken HTTP/1.1
GET /broken HTTP/1.1
Range: bytes=3000000-

HTTP/1.1 206 Partial Content
Content-Range: bytes 3000000-8388607/8388608

Continuation is useful only when the server’s range response is trustworthy. Check the final size and, where one is published, a SHA-256 digest. A proxy can also interfere with ranges by caching or rewriting them, so compare a direct run with a proxied run when the resumed file is unexpectedly short.

Uploads, forms, and APIs

curl is usually clearer for uploads because its options map directly to the HTTP request. The local harness recorded all three forms below: URL-encoded data, JSON, and multipart file data.

# URL-encoded form
curl --data 'q=proxy&page=2' http://127.0.0.1:28601/upload

# JSON with an explicit media type
curl --header 'Content-Type: application/json' \
  --header 'Accept: application/json' \
  --data '{"q":"proxy"}' http://127.0.0.1:28601/upload

# Multipart file field
curl --form 'file=@data.csv' http://127.0.0.1:28601/upload

Wget can send a POST body with --post-data or --post-file, and it can add a header with --header. For a single form that is enough. For a client with several methods, bearer tokens, multipart parts, and response assertions, curl’s syntax makes the request easier to audit. Neither command is an API client with schema validation, pagination, or a secret store, so move repeated business logic into a small program once the shell line grows beyond a few checks.

Errors worth recognizing

curl’s exit status identifies the transport problem. For example, libcurl documents 7 as “failed to connect to host or proxy,” 52 as “nothing was returned,” 56 as a receive failure, and 60 as certificate verification failure. Wget’s exit status is broader: its manual groups errors into generic, file, network, protocol, and server-response classes. In both tools, capture stderr and preserve the HTTP status separately.

if ! out=$(curl --silent --show-error --fail-with-body \
    --write-out '\nhttp=%{http_code}\n' \
    --output response.json https://api.example.test/items); then
  rc=$?
  printf 'curl transport or HTTP failure, rc=%s\n%s\n' "$rc" "$out" >&2
  exit "$rc"
fi
cat response.json

Do not branch on a single curl number across unrelated builds for every case. The meaning of a code is stable, but the human-readable wording and the point at which a proxy failure is surfaced can vary by version and TLS backend. In our earlier proxy matrix, two curl builds reported different exit codes for a failed CONNECT even though the proxy sent the same 403. The safe discriminator was the CONNECT response and the proxy log.

Practical recipes

For one API request, use curl with an explicit timeout, an explicit accept type, and a bounded redirect policy:

curl --fail-with-body --silent --show-error \
  --connect-timeout 5 --max-time 30 --max-redirs 5 --location \
  --header 'Accept: application/json' \
  --write-out '\nstatus=%{http_code} total=%{time_total}s\n' \
  https://api.example.test/items

For an overnight artifact download, use Wget with a log and a checksum step:

wget --continue --tries=5 --timeout=30 \
  --output-file=artifact.log \
  https://downloads.example.test/tool.tar.zst
shasum -a 256 -c tool.tar.zst.sha256

For a bounded documentation snapshot, use Wget’s recursion controls and a delay. For a link audit, replace the recursive command with --spider. For a proxy debugging session, use curl’s verbose output first, then reduce it to a write-out line after you know which layer is answering.

Do not turn off TLS verification to make a proxy test pass. A -k or --no-check-certificate run can hide a TLS-intercepting proxy or a wrong hostname. Install the correct trust chain or fix the proxy path, then rerun with verification enabled.

Method and limits

The request-header examples came from audit/work/curl-vs-wget/runs/origin.log and the proxy examples from proxy.log, generated by the local harness in this repository. The speed table uses the seven-run result in runs/bench.json. The origin was loopback, the payload was generated locally, and the commands wrote to /dev/null. We did not compare public internet routes, disk speeds, IPv6, HTTP/3, Windows builds, or a loaded proxy. Versions and defaults change, so rerun the harness when you upgrade either program.

For the normative behavior, read the curl command-line manual, the curl tutorial, and libcurl’s error-code reference. GNU’s Wget 1.25.0 manual covers downloads, proxies, retries, continuation, and recursive retrieval. Those references are more reliable than a remembered flag from an older release.

Frequently asked questions

Which is better for an API, curl or Wget?
curl is usually the better fit because methods, headers, JSON bodies, multipart forms, proxies, and response fields are explicit options. Move complex state and retries into a real HTTP client.
Which is better for downloading a website?
Wget. Its recursive mode follows HTML and CSS links, limits depth, builds a directory tree, and respects robots.txt. Bound the host, path, depth, and request rate.
Is curl faster than Wget?
There is no universal winner. Our seven-run loopback measurement had Wget at a 0.037 second median for 512 MiB and curl at 0.043 seconds. That was not an internet or disk benchmark.
Can both use an HTTP proxy?
Yes. curl uses --proxy or proxy environment variables. Wget uses the same environment convention or its configuration file. For HTTPS both send CONNECT before TLS.
Do curl and Wget send the same headers?
No. Our local origin saw curl send User-Agent and Accept, while Wget also sent Accept-Encoding: identity and Connection: Keep-Alive. Inspect the wire when a target treats them differently.
How do I resume a broken download?
Use curl --continue-at - or Wget --continue, then verify the final size and a published digest. Range support is required and a proxy can alter range behavior.
Should I put proxy passwords on the command line?
Avoid real secrets in shell history and process listings. Use a protected config or environment supplied by the process manager, and percent-encode reserved URL characters.

Sources

  1. curl command-line manual
  2. curl tutorial
  3. libcurl error codes
  4. libcurl API overview and persistent connections
  5. GNU Wget 1.25.0 manual
  6. GNU Wget manual: overview
  7. GNU Wget manual: download options
  8. GNU Wget manual: HTTP options
  9. GNU Wget manual: proxies
  10. GNU Wget manual: recursive download
  11. GNU Wget manual: recursive retrieval options
  12. RFC 9110: HTTP Semantics

Read this page as Markdown · Quote it freely under CC BY 4.0 with a link back.