# Ports

In **computer networking**, a **port** is a **virtual communication endpoint** — like a numbered “door” that allows specific types of network traffic to enter or leave a device.

***

#### **1. What a Port Is**

* Every device on a network has an **IP address** (like a street address).
* Each application or service running on that device “listens” on a **port number** (like a specific apartment number).
* Ports help your computer know **which program** should handle incoming or outgoing data.

For example:

* The IP address identifies **the device**.
* The port number identifies **the service or process** on that device.

So, when you connect to a website, your computer sends data to:

```
IP address:port number
```

like `142.250.191.46:443` (Google’s IP on HTTPS port).

***

#### **2. What Ports Do**

Ports organize and manage multiple network connections happening at the same time.\
They allow different applications to use the network **without interfering** with each other.

For example:

* Web browser uses port **80** (HTTP) or **443** (HTTPS)
* Email client uses port **25** (SMTP) or **993** (IMAP)
* File Transfer Protocol uses port **21** (FTP)

Your computer can be downloading a file, streaming music, and browsing the web simultaneously — each using different ports.

***

#### **3. Types of Ports**

There are **65,535 total ports** for each IP address:

* **Well-known ports (0–1023):** Reserved for common services\
  e.g., HTTP (80), HTTPS (443), FTP (21), DNS (53)
* **Registered ports (1024–49151):** Used by user or vendor-specific apps\
  e.g., MySQL (3306), RDP (3389)
* **Dynamic/private ports (49152–65535):** Used temporarily by applications when making outbound connections

***

#### **4. Example**

If you type `https://example.com` in a browser:

1. DNS resolves “example.com” to an IP address.
2. Your browser connects to that IP address on **port 443** (HTTPS).
3. The web server listens on port 443, accepts the request, and sends back the webpage.

***

#### **Common Ports**

<figure><img src="https://3601924473-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FgFpI6H35EMjG52w5PcIP%2Fuploads%2FCVqrAscsy1qQQqbszA2b%2FCommon-Ports-Cheet-Sheet2-1024x606.jpg?alt=media&#x26;token=2440f448-ef81-4f57-a97e-a897a9c70b83" alt=""><figcaption></figcaption></figure>
