Wget vs Curl

Both fetch things from URLs and both are probably on your machine. They were built for different jobs: wget to download files reliably, curl to make any single request you can describe.

Last updated . How this page is checked.

The command

curl -fLO https://example.com/file.tar.gz
wget https://example.com/file.tar.gz

Equivalent commands

Taskcurl / wget
Save to a filecurl -O URL  /  wget URL
Print to the terminalcurl URL  /  wget -qO- URL
Choose the filenamecurl -o name URL  /  wget -O name URL
Follow redirectscurl -L URL  /  wget does by default
Resume a downloadcurl -C - -O URL  /  wget -c URL
Send a headercurl -H "K: v" URL  /  wget --header="K: v" URL
POST datacurl -d "a=1" URL  /  wget --post-data="a=1" URL
Basic authcurl -u user:pw URL  /  wget --user=user --password=pw URL
Show response headerscurl -i URL  /  wget -S URL
Limit speedcurl --limit-rate 1M URL  /  wget --limit-rate=1m URL

Opposite defaults

Almost every difference you will notice comes from the defaults. Wget saves to a file, follows redirects and retries a failed download on its own. Curl prints to standard output, stops at a redirect and tries once. Neither is better; they reflect what each tool expects you to be doing. It does mean a command translated flag for flag behaves differently unless you add the missing defaults back.

What only one of them does

Wget can download recursively: follow the links in a page, fetch what they point to, and rewrite the links so the copy works offline. That makes it the tool for mirroring a site or grabbing every file in a directory listing. Curl has no equivalent.

Curl speaks far more protocols and gives precise control over a single HTTP request: any method, multipart uploads, client certificates, detailed timing with -w. It is also a library, libcurl, which is what many programming languages use underneath their HTTP clients. For calling an API, curl is the natural choice, and it is the format API documentation uses.

# mirror a documentation site for offline reading
wget --mirror --convert-links --page-requisites --no-parent https://example.com/docs/

# time each phase of a single request
curl -s -o /dev/null -w "dns %{time_namelookup}s  connect %{time_connect}s  total %{time_total}s\n" https://example.com/

Which to use

Downloading a file, especially a large one over a poor connection, or copying part of a site: wget, because its defaults already do the right thing. Testing an endpoint, sending anything other than a simple GET, or scripting against an API: curl. In a minimal container you often get only one of them, and for a plain download either works.

Common mistakes

  • wget discards the body of an error response unless you add --content-on-error, so the API's explanation of a 400 never reaches you.
  • wget cannot build a multipart upload. There is no equivalent of curl -F.
  • BusyBox wget, common in small container images, supports only a fraction of GNU wget's options.

Related curl examples

More under Reference

References

These links leave api-tester.com, which is independent of the projects they point to.

FAQ

What is the difference between wget and curl?

Wget is a downloader: it saves to files, follows redirects, retries and can mirror sites recursively. Curl is a general transfer tool that prints to standard output and gives detailed control over individual requests.

Is curl or wget better for downloading files?

Wget needs fewer flags for a robust download because it retries and follows redirects by default. Curl does the same job with -L, -O and --retry added.

Can wget send a POST request?

Yes, with --post-data or --post-file, and --header for headers. It cannot send multipart form uploads.