How the TCP Port 21 Works With FTP

The File Transfer Protocol Uses Port 20 and 21

Documents getting exchanged from files
Westend61 / Getty Images

The File Transfer Protocol (FTP) provides a means to transfer information online, much like how the Hypertext Transfer Protocol (HTTP) is used through a web browser. FTP, however, operates on two different TCP ports: 20 and 21.

After the correct FTP username and password is entered through the FTP client software, the FTP server software opens port 21 by default, which is sometimes called the command or control port.

Then, the client makes another connection to the server over port 20 so that the actual file transfers can take place.

The default port for sending commands and files over FTP can be changed but the reason there's a standard is so that client/software programs, routers, and firewalls can all agree on the same ports to make configuration much easier.

How to Connect Over FTP Port 21

A common problem with FTP not working is that the correct ports are not open on the network. This can take place on either the server side or the client side. Any software blocking the ports must be manually changed to open them, including routers and firewalls.

By default, routers and firewalls might not accept connections on port 21. If FTP isn't working, it's best to first check that the router is properly forwarding requests on that port and that the firewall isn't blocking port 21.

Tip: You can use Port Checker to scan your network to see if the router has port 21 open.

There's also a feature called passive mode that can be used if there are problems with port access behind a router.

In addition to ensuring port 21 is open on both sides of the communication channel, port 20 should also be allowed on the network and through the client software. Neglecting to open both ports means that the full back-and-forth transfer can not be made.

Once connected to the FTP server, the client software prompts with the login credentials (username and password) necessary for accessing that particular server.

FileZilla and WinSCP are two extremely popular FTP clients.