Most Common TCP and UDP Ports and Their Services (With Security Notes)

A port is a 16-bit number from 0 to 65535 that tells the operating system which service should receive a TCP or UDP packet. The ports every network and security learner should know are 20 and 21 (FTP), 22 (SSH), 23 (Telnet), 25 (SMTP), 53 (DNS), 80 (HTTP), 123 (NTP), 161 (SNMP), 443 (HTTPS), 445 (SMB), 3306 (MySQL) and 3389 (RDP). IANA keeps the official registry.

Apr 09, 2025 - 11:56
Updated: 
111.9k

Ethical Hacking in Cybersecurity & Ethical Hacking · Explainer

Networking, Network Security

Most Common TCP and UDP Ports and Their Services (With Security Notes)

Quick answer: A port is a 16-bit number from 0 to 65535 that tells the operating system which service should receive a TCP or UDP packet. The ports every network and security learner should know are 20 and 21 (FTP), 22 (SSH), 23 (Telnet), 25 (SMTP), 53 (DNS), 80 (HTTP), 123 (NTP), 161 (SNMP), 443 (HTTPS), 445 (SMB), 3306 (MySQL) and 3389 (RDP). IANA keeps the official registry. For each port, learn three things: which service normally uses it, whether it runs over TCP, UDP or both, and what goes wrong when it is exposed or left unencrypted.

Key takeaways

  • RFC 6335 splits ports into system (0 to 1023), user (1024 to 49151) and dynamic (49152 to 65535) ranges.
  • A port number only suggests a service; anyone can run SSH on 2222, so confirm with service detection.
  • Cleartext protocols such as Telnet, FTP and HTTP should be replaced by encrypted versions.
  • SMB, RDP and database ports should almost never face the internet directly.
  • Close what you do not use; every open port is a service you must patch.

Table of Contents

What Is a Port and Who Assigns Port Numbers?

An IP address gets a packet to a host. The port number gets it to the right program on that host. The Internet Assigned Numbers Authority maintains the service name and port number registry, and RFC 6335 defines the three ranges. System ports below 1024 usually need administrator rights to open. Dynamic ports are picked temporarily by clients for outgoing connections.

How Do TCP and UDP Ports Differ?

TCP sets up a connection with a handshake and guarantees ordered delivery. UDP sends datagrams with no handshake, which suits DNS queries, time sync and streaming. TCP port 53 and UDP port 53 are separate sockets, even though both serve DNS. Modern web traffic also uses UDP: HTTP/3 runs over QUIC on UDP 443.

Which Common Ports Should You Know?

PortProtocolServiceSecurity note
20, 21TCPFTP data and controlCleartext logins; use SFTP or FTPS
22TCPSSH, SFTPBrute-force target; use keys, disable password and root login
23TCPTelnetCleartext; disable and use SSH
25TCPSMTP relayPrevent open relay; clients should submit on 587 or 465
53UDP, TCPDNSBlock open recursion and unauthorised zone transfers
67, 68UDPDHCPRogue servers; enable DHCP snooping on switches
80TCPHTTPRedirect to HTTPS
110, 995TCPPOP3, POP3 over TLSAllow only the TLS version
123UDPNTPAbused for amplification; restrict queries
143, 993TCPIMAP, IMAP over TLSAllow only the TLS version
161, 162UDPSNMP, SNMP trapsDefault community strings leak data; use SNMPv3
389, 636TCPLDAP, LDAPSRequire signing or TLS; keep internal
443TCP, UDPHTTPS, HTTP/3Keep TLS configuration current
445TCPSMBNever expose to the internet; disable SMBv1
1433TCPMicrosoft SQL ServerKeep internal; strong authentication
3306TCPMySQL, MariaDBBind to localhost or private network
3389TCP, UDPRDPPut behind VPN or gateway with MFA
5432TCPPostgreSQLKeep internal; restrict in pg_hba.conf
5900TCPVNCWeak or no passwords are common; tunnel it
6379TCPRedisEnable authentication and bind to localhost

Which Ports Are Riskiest to Expose?

Remote access and file sharing ports attract the most attention because they hand an attacker a login prompt or a file system. MITRE ATT&CK records adversaries using RDP to move between systems once they have valid credentials, and scanning for exposed services is a standard discovery step (T1046). Microsoft advises blocking inbound SMB at the network edge in its guidance on securing SMB traffic. Databases, Redis and VNC installed with defaults on cloud servers cause similar problems.

How Do You Check Which Ports Are Open on Your Own Systems?

Start from the host itself. These commands list listening sockets on machines you administer:

# Linux: listening TCP and UDP sockets with owning process
sudo ss -tulpn

# Windows PowerShell: listening TCP ports and process IDs
Get-NetTCPConnection -State Listen | Sort-Object LocalPort

# Windows: UDP endpoints
Get-NetUDPEndpoint | Sort-Object LocalPort

Then confirm the outside view with an authorised external scan, because a firewall may block what the host listens on, or a forgotten NAT rule may expose it. Scanning networks you do not own or have written permission to test can be an offence under Sections 43 and 66 of India's IT Act 2000.

How Do You Secure Open Ports?

  1. Inventory every listening service and remove what is not needed.
  2. Use a default-deny firewall and allow only required ports from required sources.
  3. Replace cleartext protocols with encrypted ones.
  4. Put admin services such as SSH and RDP behind a VPN or bastion with MFA.
  5. Patch exposed services first and log connection attempts.

How Should Students Memorise Ports?

Group ports by job: remote access (22, 23, 3389, 5900), web (80, 443), mail (25, 110, 143, 465, 587, 993, 995), name and time services (53, 123), file sharing (21, 445) and databases (1433, 3306, 5432). Read our complete list of computer ports for a wider reference, and revise the difference between TCP and UDP. WebAsha runs networking and ethical hacking training with hands-on labs.

References

Frequently Asked Questions

There are 65,536 port numbers, from 0 to 65535, for TCP and the same range again for UDP, since each protocol has its own ports.

Ports 0 to 1023 are called system or well-known ports in RFC 6335. They are assigned by IANA to core services such as SSH, DNS and HTTPS.

HTTPS uses TCP port 443, and HTTP/3 uses UDP port 443 through the QUIC protocol, so firewalls may need to allow both.

Both. Most queries use UDP port 53, while zone transfers and large responses use TCP port 53, so both must be considered in firewall rules.

Port 445 carries SMB file sharing, which has a long history of serious flaws and worms, so Microsoft recommends blocking it at the edge.

It reduces automated noise but does not stop a targeted attacker. Key-based authentication, MFA and patching are the real controls.

On Linux run ss -tulpn, and on Windows use Get-NetTCPConnection -State Listen in PowerShell to list listening ports and processes.

Scanning your own systems is fine. Scanning others without written permission can breach Sections 43 and 66 of the IT Act 2000.

What's Your Reaction?

Like Like 0
Dislike Dislike 0
Love Love 0
Funny Funny 0
Wow Wow 0
Sad Sad 0
Angry Angry 0
Vaishnavi

Vaishnavi is a skilled tech professional at the Ethical Hacking Training Institute in Pune, responsible for managing and optimizing the technical infrastructure that supports advanced cybersecurity education. With deep expertise in network security, backend operations, and system performance, she ensures that practical labs, online modules, and assessments run smoothly and securely. Her behind-the-scenes contributions play a vital role in delivering a seamless and secure learning experience for aspiring ethical hackers.