Getting started

Proxy formats: host:port:user:pass and URLs

Proxy formats explained: host:port:user:pass, user:pass@host:port and http, https, socks5 and socks5h URLs, plus how to convert a proxy list for any tool.

3 min read Updated

On this page

A proxy comes down to four values: a host, a port, a username and a password. The values stay the same, but every tool wants them written a little differently. This page shows the formats you'll meet, what the URL schemes mean and how to convert between them.

The four parts

Part Placeholder Notes
Host HOST The proxy server from your dashboard
Port PORT Use the port that matches the protocol, HTTP or SOCKS5
Username USERNAME On some plans it carries options such as country or session
Password PASSWORD Keep it private

Your dashboard shows the exact host, ports and username format for your plan, and its generator builds complete lines for you, including country and session options. Copy the username as one piece. If you change part of it by hand, the proxy may reject it or ignore the option.

Plain line formats

These formats are common in proxy lists, antidetect browsers and bulk tools.

host:port:user:pass

HOST:PORT:USERNAME:PASSWORD

This is the most widely accepted list format. Tools split the line at each colon, so it breaks if the username or password contains a colon.

user:pass@host:port

USERNAME:PASSWORD@HOST:PORT

The same order as a URL, without the scheme. Some tools expect other orders, such as HOST:PORT@USERNAME:PASSWORD or USERNAME:PASSWORD:HOST:PORT. If a tool doesn't say which order it wants, test with one line before you import a whole list.

URL formats

Most libraries and command-line tools take a proxy URL:

http://USERNAME:PASSWORD@HOST:PORT
https://USERNAME:PASSWORD@HOST:PORT
socks5://USERNAME:PASSWORD@HOST:PORT
socks5h://USERNAME:PASSWORD@HOST:PORT

The scheme at the start tells the tool how to talk to the proxy. It says nothing about the websites you visit.

Scheme Connection to the proxy Who resolves domain names Use it when
http:// Plain HTTP; HTTPS sites go through an encrypted tunnel The proxy Almost always. It is the default for web traffic
https:// TLS to the proxy itself The proxy Only if your plan lists a TLS endpoint for the proxy
socks5:// SOCKS5 Often your machine, depending on the tool The tool only speaks SOCKS5 and local DNS is acceptable
socks5h:// SOCKS5 The proxy You want SOCKS5 with DNS handled at the proxy

Two points cause most mistakes:

  • You don't need https:// to visit HTTPS websites. With an http:// proxy URL, the client asks the proxy to open a tunnel (a CONNECT request), and the encryption runs end to end between you and the website. Writing https:// in front of a plain proxy port usually fails with a TLS error such as wrong version number.
  • "HTTP(S) proxy" in a product description normally means the proxy handles both HTTP and HTTPS websites. It doesn't mean you should write https:// in the proxy URL.

The difference between socks5:// and socks5h:// is about DNS. HTTP and SOCKS5 explains when it matters and which tools accept which scheme.

Special characters in usernames and passwords

In a URL, some characters have a meaning of their own. If your username or password contains one of them, percent-encode it:

Character Encoded
@ %40
: %3A
/ %2F
# %23
? %3F
% %25
space %20

You can let your programming language do it. In Python:

from urllib.parse import quote

username = "USERNAME"
password = "PASSWORD"
proxy_url = f"http://{quote(username, safe='')}:{quote(password, safe='')}@HOST:PORT"

In JavaScript, encodeURIComponent() does the same job. Letters, digits, hyphens, underscores and dots never need encoding.

Which format your tool expects

Tool What to enter
curl -x "http://USERNAME:PASSWORD@HOST:PORT", or -x "http://HOST:PORT" -U "USERNAME:PASSWORD"
Python (requests, httpx, aiohttp) A proxy URL
Node.js (undici, proxy agents) A proxy URL
Puppeteer --proxy-server=http://HOST:PORT, then page.authenticate() with the username and password
Playwright Separate server, username and password fields
Selenium --proxy-server=http://HOST:PORT; the credentials need a workaround
Scrapy A proxy URL in meta["proxy"]
Antidetect browsers Separate fields, or a pasted HOST:PORT:USERNAME:PASSWORD line
Our Chrome extension Any of the common formats on this page

Converting a list

You rarely need to convert by hand:

  • The generator in your dashboard can format the lines it builds, so you can pick the layout your tool wants.
  • The free proxy formatter converts a pasted list from one format to another.

If you prefer the command line, this turns a file of HOST:PORT:USERNAME:PASSWORD lines into URLs. Like the format itself, it assumes no field contains a colon:

awk -F: '{ print "http://" $3 ":" $4 "@" $1 ":" $2 }' proxies.txt > proxy-urls.txt

After converting, test one line before you load the whole list. The curl guide has a one-line test.