Blog
3 min read

wget vs curl: What's the Difference and When to Use Each

wget and curl both fetch things over HTTP from the command line, but they're built for different jobs: wget downloads files (and whole sites) robustly, while curl talks to APIs and supports almost every protocol and option. Side-by-side examples for downloads, resuming, headers, POST requests and debugging.

wget and curl are both command-line tools for fetching things from the internet. They overlap a lot, but each is better at one thing:

  • wget is a downloader. Point it at a URL and it saves the file — reliably, with retries, even recursively for whole sites.
  • curl is a Swiss Army knife for requests. It prints responses to the screen by default and gives you control over every part of an HTTP request — perfect for testing APIs. (What Is curl?)

Side by side

wget curl
Default behaviour Saves to a file Prints to the terminal
Best at Downloading files, mirroring sites APIs, custom requests, debugging
Recursive downloads Yes No
Resume broken downloads -c -C -
Protocols HTTP, HTTPS, FTP Dozens (HTTP/1–3, FTP, SFTP, SMTP…)
Installed by default Most Linux; not macOS macOS, Windows 10+, most Linux
Also a library No Yes (libcurl, used by countless apps)

Downloading a file

wget https://example.com/backup.tar.gz
curl -O https://example.com/backup.tar.gz     # -O keeps the remote name
curl -o mybackup.tar.gz https://example.com/backup.tar.gz

Resume an interrupted download:

wget -c https://example.com/big.iso
curl -C - -O https://example.com/big.iso

Follow redirects — wget does by default; curl needs -L:

curl -LO https://github.com/owner/repo/releases/latest/download/tool.tar.gz

Talking to an API (curl's home turf)

curl https://api.example.com/users/42

curl -X POST https://api.example.com/users \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer $API_TOKEN" \
  -d '{"name":"Ana"}'

wget can POST too, but it's clumsy for this. (How to Test an API)

Debugging

See the response headers only:

curl -I https://yourapp.com

See everything — DNS, TLS handshake, request and response headers:

curl -v https://yourapp.com

Check how long each part of a request takes:

curl -o /dev/null -s -w "dns %{time_namelookup}s  connect %{time_connect}s  total %{time_total}s\n" https://yourapp.com

These are invaluable for "is it my app, DNS or HTTPS?" problems. (What Is Latency?)

Mirroring a site (wget's party trick)

wget --mirror --convert-links --page-requisites --no-parent https://example.com/docs/

That downloads a browsable offline copy. Be polite with other people's sites (--wait=1), and respect their terms.

A warning about curl ... | bash

Install instructions often say curl -fsSL https://... | bash. That runs a script from the internet with no chance to read it first. Only do it for sources you trust, and when in doubt, download it, read it, then run it.

Which should you use?

  • Downloading a file on a server: either; wget is simpler.
  • Testing an API, debugging HTTPS or headers: curl.
  • Scripting HTTP calls: curl.
  • Mirroring a website: wget.

The summary

  • wget = downloader; curl = request tool.
  • curl -I and curl -v are the best quick debugging tools for web problems.
  • Both are free and worth having.

EasySpawn servers come with both tools installed, and Claude Code uses curl to check your app's endpoints, headers and HTTPS after every deploy. See how it works or join the waitlist.

Related: HTTP Headers Explained · GET vs POST · Basic Linux Commands · SCP vs rsync

Keep reading