TCP vs. UDP Ports: What’s the Difference and When Is Each Used?

TCP ports support reliable, connection-oriented communication, while UDP ports support connectionless data transmission with lower protocol overhead. Both use the same numerical port range but operate independently.

Georgios Angelis
By
Georgios Angelis
Georgios Angelis
Web Developer & Digital Marketing Expert
Georgios Angelis is a Web Developer and Digital Marketing Expert based in Thessaloniki, Greece, with extensive professional experience in website development, search engine optimization (SEO), digital...
- Web Developer & Digital Marketing Expert
8 Min Read

A web server can receive data on both TCP port 443 and UDP port 443 at the same time. These can both exist independently of one another.

This is possible as TCP and UDP have their own port space. A port is associated with a specific transport protocol and so does not function as a universal endpoint identifier for an operating system.

This knowledge is helpful for firewall, service and port forwarding configuration.

What Is A Network Port?

An IP address refers to a device or network interface. Transport layer ports are used to identify which application or service should receive data.

Transport layer ports are 16-bit values and so can vary from 0 to 65535. These are organised by the Internet Assigned Numbers Authority (IANA) into three groups:

Port rangeClassification
0–1023System ports
1024–49151User ports
49152–65535Dynamic or private ports

Port 0 is not available. Operating systems may also utilise differing ranges for dynamically allocated source ports.

During a website visit, your computer will generally send data to a server using a dynamic source port. This enables numerous applications and browser sessions to communicate concurrently.

How TCP Ports Work

TCP requires a connection to be created before sending data.

Typically, a 3-step process is followed:

1. The client sends a SYN (synchronise) message requesting a connection.

2. The server responds with a SYN-ACK (synchronise-acknowledge) message.

3. The client then sends an ACK (acknowledge) message.

TCP then controls data transmission using sequence numbers, acknowledgements, re-transmission and flow control.

Should data fail to be successfully received, TCP can re-transmit it. TCP can also piece together data that has been delivered out of order and then pass this to the relevant application.

This is highly advantageous for file transfer. For example, when downloading a software installation file, it is not enough to receive 99% of the data. Even a small number of missing bytes can cause the downloaded executable to fail.

TCP is widely used for web, email, remote access and database services.

How UDP Ports Work

Unlike TCP, UDP does not require a transport layer connection to be formed prior to data transmission.

UDP headers are also smaller than TCP’s minimum header size – only 8 bytes in comparison to 20 bytes.

UDP does not have in-built functionality for re-transmission, acknowledgement or sequencing. These features must therefore be added by further protocols or within applications.

Whilst listening to someone speak, for example, re-playing audio that was meant to be played 2 seconds ago would be largely ineffective. By the time this audio was received, the dialogue would have progressed.

Many real-time services choose UDP as it permits greater control over latency and data loss.

Popular examples include online games, voice chat and DNS. Contemporary Virtual Private Network (VPN) technology also often uses UDP.

TCP and UDP – Key Differences

CharacteristicTCPUDP
Connection establishmentRequiredNot required
Minimum header size20 bytes8 bytes
Delivery confirmationBuilt inNot built in
RetransmissionSupportedNot built in
Ordered deliverySupportedNot guaranteed
Congestion controlBuilt inApplication-dependent
Broadcast and multicastNoSupported

Whilst UDP is not always faster than TCP, the actual speed will depend on a number of factors including network performance, application type, congestion control and data volume.

Common TCP and UDP Port Numbers

Most network services are assigned standard default ports. However, these can be changed.

Network servicePortProtocol
SSH22TCP
SMTP25TCP
DNS53TCP and UDP
DHCP67, 68UDP
HTTP80TCP
NTP123UDP
HTTPS443TCP
HTTP/3443UDP
SMB445TCP
Remote Desktop3389TCP and UDP

Note that transport protocol associations are not prescriptive.

Provided clients connect to a web server via TCP port 8443, the server can function efficiently even if it is configured to receive HTTPS data on this port.

Modern web browsers now utilise both TCP and UDP.

Whilst current versions of HTTPS (HTTP/1.1 or HTTP/2) still rely on TCP for data transmission, HTTP/3 uses a UDP-based transport protocol called QUIC.

QUIC has its own methods for ensuring reliability, encryption, congestion control and sequencing.

As distinct transport streams can be affected independently by data loss, good network performance can be achieved in some situations. This is because data loss on one stream does not necessarily impact other streams on the same connection.

Therefore, if UDP port 443 is blocked by a firewall, HTTP/3 connections may be affected. Regular HTTPS browsing can still occur however, as this continues to utilise TCP.

How To View TCP and UDP Ports On Windows

Windows provides various tools for analysing network endpoints.

Launch Command Prompt and run:

netstat -ano

This will show details of the protocol, local and remote addresses and process ID (PID) for each endpoint.

For further focussed analysis, run the following command in PowerShell to list TCP endpoints that are listening:

Get-NetTCPConnection -State Listen

And use this PowerShell command to analyse UDP endpoints:

Get-NetUDPEndpoint

Information regarding the process responsible for an endpoint is also provided. This can be analysed by inputting a PID into the below command:

Get-Process -Id 1234

Ensure that you substitute 1234 with the relevant process ID.

This can be especially helpful for diagnosing port issues and analysing unknown background processes.

TCP and UDP – Firewalls and Port Forwarding

Whilst choosing the right port number is important when setting up a firewall or router, it is also crucial to define the correct transport protocol.

Simply opening TCP port 51820 will not enable access to a typical WireGuard virtual private network (VPN) if the associated server is configured to receive UDP data on this port.

To analyse a TCP port on a remote device from Windows, run:

Test-NetConnection example.com -Port 443

A successful response indicates that a TCP connection could be successfully formed. However, this does not guarantee that the application servicing the port is operating correctly.

UDP analysis is more complex as there is no compulsory connection process. A UDP service may also fail to respond to a datagram it has received. As such, application-specific analysis is typically required.

Neither TCP nor UDP can themselves encrypt data. Additional protocols, such as TLS, QUIC or WireGuard, must be used to achieve secure data transmission.

Only open the TCP and UDP ports that your applications actually need. Randomly opening both protocols unnecessarily increases your network’s vulnerability to attack and is unlikely to enhance network performance.

Share This Article
Georgios Angelis
Web Developer & Digital Marketing Expert
Follow:
Georgios Angelis is a Web Developer and Digital Marketing Expert based in Thessaloniki, Greece, with extensive professional experience in website development, search engine optimization (SEO), digital advertising, e-commerce, and web technologies. He is a Google-certified professional and runs Netclick Digital, a digital marketing agency recognized as a Google Partner. His professional expertise includes Google Ads, Meta Ads, technical SEO, WordPress development, PHP programming, web analytics, marketing automation, and digital growth strategies. Combining technical development skills with data-driven marketing expertise, he helps businesses improve their online visibility, website performance, customer acquisition, and digital presence. As a contributing author at SkillOnPage, Georgios shares practical knowledge and professional insights on web development, programming, digital marketing, SEO, artificial intelligence, e-commerce, and emerging digital technologies.
Leave a Comment

Leave a Reply

Your email address will not be published. Required fields are marked *