     [Answers](https://scrapfly.io/blog)   /  [curl](https://scrapfly.io/blog/tag/curl)   /  [How To Use Proxy With cURL?](https://scrapfly.io/blog/answers/how-to-use-proxy-with-curl)   # How To Use Proxy With cURL?

 by [Mazen Ramadan](https://scrapfly.io/blog/author/mazen) Apr 14, 2026 2 min read [\#curl](https://scrapfly.io/blog/tag/curl) [\#proxies](https://scrapfly.io/blog/tag/proxies) 

 [  ](https://www.linkedin.com/sharing/share-offsite/?url=https%3A%2F%2Fscrapfly.io%2Fblog%2Fanswers%2Fhow-to-use-proxy-with-curl "Share on LinkedIn")    

 

 

Proxies are essential to avoid IP address blocking and accessing restricted web pages over a specific location. In a nutshell, proxies are servers that allow for IP address hiding by requesting the web source through another, acting as a middleware.

To add proxy to cURL, we can use the `-x` or `--proxy` options. Let's explore using these options for proxy types.

#### HTTP and HTTPs Proxies

The general command for setting HTTP proxy with cURL is the following:

bash```bash
curl -x <protocol>://<proxy_host>:<proxy_port> <url>
```



The `protocol` indicates the HTTP protocol in the case of the HTTP proxies. It can be either `htttp` or `https` depending on the proxy type, as using the `https` protocol with a proxy that doesn't support it will result in errors. The `proxy_host` and `proxy_port` are configured based on the proxy itself. The `proxy_host` can be represented as a numeric IP address or domain name.

Here is an example of setting HTTP proxies with cURL. The actual proxy hostname and port are mocked:

bash```bash
# HTTP proxy
curl --proxy http://123.12.12.12:1234 http://example.com/
curl --proxy http://some_proxy_domain:1234 http://example.com/

# HTTPs proxy
curl --proxy https://123.12.12.12:1234 https://example.com/
curl --proxy https://some_proxy_domain:1234 https://example.com/
```



#### Authenticated Proxies

To proxy authentication with cURL, we only have to add the username and password as a prefix to the proxy. The same HTTP and HTTPs rules are also applied:

```
# HTTP proxy with authentication
curl --proxy http://username:password@123.12.12.12:1234 http://example.com/
curl --proxy http://username:password@some_proxy_domain:1234 http://example.com/

# HTTPs proxy with authentication
curl --proxy https://username:password@123.12.12.12:1234 https://example.com/
curl --proxy https://username:password@some_proxy_domain:1234 https://example.com/
```



#### SOCKS Proxies

The socks proxies operate over the `SOCKS4` or the `SOCKS5` protocol. Here is how to use socks proxies with cURL:

bash```bash
#SOCKS4
curl --proxy socks4://123.12.12.12:1234 http://example.com

#SOCKS5
curl --proxy socks5://123.12.12.12:1234 http://example.com
```





 

    



Scale Your Web Scraping

Anti-bot bypass, browser rendering, and rotating proxies, all in one API. Start with 1,000 free credits.

  No credit card required  1,000 free API credits  Anti-bot bypass included 

 [Start Free](https://scrapfly.io/register) [View Docs](https://scrapfly.io/docs/onboarding) 

 Not ready? Get our newsletter instead. 

 

## Explore this Article with AI

 [ ChatGPT ](https://chat.openai.com/?q=Summarize%20this%20page%3A%20https%3A%2F%2Fscrapfly.io%2Fblog%2Fanswers%2Fhow-to-use-proxy-with-curl) [ Gemini ](https://www.google.com/search?udm=50&aep=11&q=Summarize%20this%20page%3A%20https%3A%2F%2Fscrapfly.io%2Fblog%2Fanswers%2Fhow-to-use-proxy-with-curl) [ Grok ](https://x.com/i/grok?text=Summarize%20this%20page%3A%20https%3A%2F%2Fscrapfly.io%2Fblog%2Fanswers%2Fhow-to-use-proxy-with-curl) [ Perplexity ](https://www.perplexity.ai/search/new?q=Summarize%20this%20page%3A%20https%3A%2F%2Fscrapfly.io%2Fblog%2Fanswers%2Fhow-to-use-proxy-with-curl) [ Claude ](https://claude.ai/new?q=Summarize%20this%20page%3A%20https%3A%2F%2Fscrapfly.io%2Fblog%2Fanswers%2Fhow-to-use-proxy-with-curl) 



 ## Related Articles

 [  

 blocking proxies 

### How to Hide Your IP Address

In this article we'll be taking a look at several ways to hide IP addresses: proxies, tor networks, vpns and other techn...

 

 ](https://scrapfly.io/blog/posts/how-to-hide-your-ip-address-while-scraping) [  

 curl 

### How to Use cURL GET Requests

Here's everything you need to know about cURL GET requests and some common pitfalls you should avoid.

 

 ](https://scrapfly.io/blog/posts/how-to-use-curl-get-requests) [  

 http tools 

### How to Use cURL For Web Scraping

In this article, we'll go over a step-by-step guide on sending and configuring HTTP requests with cURL. We'll also explo...

 

 ](https://scrapfly.io/blog/posts/how-to-use-curl-for-web-scraping) 

  ## Related Questions

- [ Q How to Follow Redirects In cURL? ](https://scrapfly.io/blog/answers/how-to-follow-redirects-in-curl)
- [ Q How to Set User Agent With cURL? ](https://scrapfly.io/blog/answers/how-to-set-curl-user-agent)
- [ Q What is The cURL (28) Error, Couldn't connect to server? ](https://scrapfly.io/blog/answers/what-is-the-curl-28-error)
- [ Q How to Solve the cURL (60) Error When Using Proxy? ](https://scrapfly.io/blog/answers/how-to-solve-the-curl-60-error-when-proxy)
 
  



   



 Premium rotating proxies for scraping, **1,000 free credits** [Start Free](https://scrapfly.io/register)