What is cURL?
cURL is a free, versatile command-line tool used for transferring data with URL syntax, supporting protocols like HTTP, HTTPS, FTP, and more. It is commonly used by developers and system administrators for tasks such as downloading files, making API calls, and testing web services.
While macOS and Linux include cURL by default, Windows users are left to install it manually. Although PowerShell offers cmdlets like Invoke-WebRequest
that mimic some of cURL’s functionality, users accustomed to Unix tools may find themselves asking: Where is cURL on Windows?
This guide will walk you through five different ways to install cURL on Windows and provide examples to help you start using it.
Table of Contents
- Why Install cURL on Windows?
- How to Install cURL on Windows
- How to Use cURL on Windows
- Practical Examples of cURL Commands
- Troubleshooting Common Issues
- Summary and Next Steps
Why Install cURL on Windows?
Installing cURL on Windows opens up a world of powerful command-line operations. It allows you to:
- Automate file transfers.
- Test RESTful APIs.
- Fetch web content and headers.
- Perform advanced network diagnostics.
Windows users can leverage cURL to bridge the gap between Windows and Unix environments, enabling seamless compatibility with cross-platform scripts and workflows.
How to Install cURL on Windows
1. Install cURL using Chocolatey
Chocolatey is a popular Windows package manager that simplifies software installation.
- First, install Chocolatey by following the instructions here.
- Once installed, open a PowerShell or Command Prompt as Administrator and run the following:
choco install curl -y
Chocolatey will handle the installation for you, and cURL will be ready to use.
2. Downloading Pre-Compiled Binaries
For users who prefer manual installation, pre-compiled cURL binaries are available.
- Visit cURL’s downloads page.
- Scroll down to the Windows section and download the appropriate binary (e.g., Win64 – Generic).
- Extract the ZIP file and navigate to the
src
folder to findcurl.exe
. - Copy
curl.exe
to a directory in your system’s PATH, such asC:\Windows\System32
.
You can now access cURL from any command line.
3. Compiling cURL from Source Code on windows
Compiling cURL from source is an advanced method, ideal for users who need the latest version or want a hands-on learning experience.
- Download the source code from cURL’s GitHub repository.
- Follow the build instructions provided in the official documentation.
This method requires tools like Visual Studio or MinGW for compilation and is recommended only for advanced users.
4. Using CYGWIN
CYGWIN is a Unix-like environment for Windows that includes many precompiled Unix utilities.
- Download the CYGWIN installer from here.
- During installation, select the cURL package from the list of available tools.
- Complete the installation, then launch the CYGWIN terminal to use cURL.
CYGWIN provides a Unix-like experience on Windows, but it is limited to the tools included in its ecosystem.
5. Install curl on Windows Subsystem for Linux (WSL)
WSL offers a full Linux environment on Windows, complete with native tools like cURL.
Enable WSL as a Windows feature:
- Open PowerShell as Administrator and run:
wsl --install
- Install a Linux distribution (e.g., Ubuntu) from the Microsoft Store.
- Open the Linux terminal and use the
curl
command as you would on a Unix system. - Install Windows Terminal (optional)
- Using Windows Terminal enables you to open multiple tabs or window panes to display and quickly switch between multiple Linux distributions or other command lines (PowerShell, Command Prompt, Azure CLI, etc).
- Install Windows Terminal.
WSL provides a comprehensive Linux environment but requires additional setup compared to other methods.
Install WSL without the Microsoft store
If you are unable to or don’t want to use the Microsoft store, you can also download distributions from here:
- Ubuntu
- Ubuntu 24.04
- Ubuntu 22.04 LTS
- Ubuntu 20.04
- Ubuntu 20.04 ARM
- Ubuntu 18.04
- Ubuntu 18.04 ARM
- Ubuntu 16.04
- Debian GNU/Linux
- Kali Linux
- SUSE Linux Enterprise Server 12
- SUSE Linux Enterprise Server 15 SP2
- SUSE Linux Enterprise Server 15 SP3
- openSUSE Tumbleweed
- openSUSE Leap 15.3
- openSUSE Leap 15.2
- Oracle Linux 8.5
- Oracle Linux 7.9
- Fedora Remix for WSL
Once the distribution has been downloaded, navigate to the folder containing the download and run the following command in that directory, where app-name
is the name of the Linux distribution .appx file.
Add-AppxPackage .\app_name.appx
Once the Appx package has finished downloading, you can start running the new distribution by double-clicking the appx file. (The command wsl -l
will not show that the distribution is installed until this step is complete).
How to Use cURL on Windows
Once installed, launch the appropriate command-line tool (Command Prompt, PowerShell, CYGWIN, or WSL). To confirm cURL is working, run:
curl --help
This will display a list of available commands and arguments.
Practical Examples of cURL Commands
1. Downloading Files
Download a file using the -O
option:
curl -O https://example.com/file.zip
2. Fetching Webpage Headers
Inspect a webpage’s HTTP headers:
- Linux/WSL/CYGWIN:bashCopy code
curl -s -D - http://example.com -o /dev/null
- Windows PowerShell:bashCopy code
curl -s -D - http://example.com -o $null
Linux/WSL/CYGWIN:
curl -s -D - http://example.com -o /dev/null
Windows PowerShell:
curl -s -D - http://example.com -o $null
3. Making POST Requests
Post data to a server:
curl -d "key1=value1&key2=value2" -X POST http://localhost
Post a JSON file:
curl -d "@data.json" -H "Content-Type: application/json" -X POST http://localhost
Authenticate with basic credentials:
curl -u username:password http://localhost
Troubleshooting Common Issues with cURL on windows
- Command Not Found: Ensure
curl.exe
is in a directory listed in your PATH. - SSL Certificate Errors: Use the
-k
option to bypass SSL checks (not recommended for production). - Installation Fails with Chocolatey: Run the command as an Administrator.
Summary and Next Steps
This guide covered five ways to install cURL on Windows and provided practical examples to help you get started. Whether you use Chocolatey for simplicity, WSL for a full Linux experience, or another method, cURL is an indispensable tool for developers and IT professionals.
For more advanced use cases, check out the free book Everything cURL and the official documentation.
Have questions or tips? Share them in the comments or explore our other tutorials for mastering command-line tools!