Tools
Log in
English

Learn to code

Server port guide

96 portsWindows · Linux · Unix

Common ports with their service, purpose and Windows, Linux and Unix packages.

Tap a row for check commands and a security note.

PortTCP/UDPServiceWhat it doesWindowsLinuxUnix
TCPFTP dataFiles & sharingData channel the server opens in active-mode FTP.IIS FTP Server (role service)Debian/Ubuntuvsftpd, pure-ftpdRHEL/FedoravsftpdFreeBSD base ftpd · pkg: vsftpd-ssl, pure-ftpd
TCPFTPFiles & sharingControl connection for FTP login and commands.IIS FTP Server (role service)Debian/Ubuntuvsftpd, pure-ftpdRHEL/FedoravsftpdFreeBSD base ftpd · pkg: vsftpd-ssl, pure-ftpd
TCPSSHRemote accessEncrypted remote shell. SFTP, SCP and port forwarding run over it too.OpenSSH Server (optional feature, sshd service)Debian/Ubuntuopenssh-serverRHEL/Fedoraopenssh-serverBuilt-in sshd (FreeBSD, Solaris) · macOS Remote Login
TCPTelnetRemote accessOld remote terminal. Everything you type is sent in plain text.No server · client is an optional featureDebian/UbuntutelnetdRHEL/Fedoratelnet-serverpkg: freebsd-telnetd
TCPSMTPMailHow mail servers hand mail to each other.SMTP Server feature (deprecated) · Exchange ServerDebian/Ubuntupostfix, exim4RHEL/FedorapostfixmacOS ships postfix · FreeBSD base dma/sendmail · pkg: postfix
TCPUDPDNSName resolution (DNS)Turns names into IP addresses. Usually UDP; large answers and zone transfers use TCP.DNS Server roleDebian/Ubuntubind9, unbound, dnsmasqRHEL/Fedorabind, unbound, dnsmasqFreeBSD base local-unbound · pkg: bind920 (versioned)
UDPDHCP serverNetwork basicsHands out IP address, gateway and DNS to devices.DHCP Server roleDebian/Ubuntukea-dhcp4-server, isc-dhcp-serverRHEL/Fedoradhcp-serverpkg: kea, isc-dhcp44-server
UDPDHCP clientNetwork basicsWhere a device receives DHCP replies.Built in (DHCP Client service)Debian/Ubuntunetwork-manager, systemd(networkd)RHEL/FedoraNetworkManagerBuilt in (FreeBSD dhclient, macOS)
UDPTFTPFiles & sharingTiny file transfer with no login. Used for PXE boot and device config backups.WDS (Windows Deployment Services)Debian/Ubuntutftpd-hpaRHEL/Fedoratftp-serverFreeBSD base tftpd (inetd) · pkg: tftp-hpa
TCPHTTPWebPlain web. Today mostly used to redirect to HTTPS (443).IIS (Web Server role)Debian/Ubuntunginx, apache2RHEL/Fedoranginx, httpdpkg: nginx, apache24 · macOS ships httpd (Apache)
TCPUDPKerberosDirectory & authTicket-based login. Active Directory sign-in runs on it.AD DS (domain controller)Debian/Ubuntukrb5-kdcRHEL/Fedorakrb5-serverFreeBSD base Kerberos
TCPPOP3MailOld way to download mail to one computer.Exchange Server (separate product)Debian/Ubuntudovecot-pop3dRHEL/Fedoradovecotpkg: dovecot
TCPUDPrpcbindFiles & sharingTells clients which port each RPC program uses. NFS needs it.Server for NFS (role)Debian/UbunturpcbindRHEL/FedorarpcbindBuilt-in rpcbind (FreeBSD, Solaris)
UDPNTPNetwork basicsKeeps server clocks in sync.Windows Time (W32Time service)Debian/Ubuntuchrony, ntpsecRHEL/FedorachronyFreeBSD base ntpd · macOS built-in timed
TCPMS RPCRemote accessWindows RPC endpoint mapper. Remote admin, WMI and AD replication use it.Built in (RPC Endpoint Mapper)Debian/Ubuntusamba (AD DC mode)RHEL/Fedora--
UDPNetBIOS nameFiles & sharingOld Windows name lookup (computer name to IP).Built in (NetBIOS over TCP/IP)Debian/UbuntusambaRHEL/Fedorasambapkg: samba4xx (versioned, e.g. samba419)
UDPNetBIOS datagramFiles & sharingCarries network browsing (computer list) announcements.Built in (NetBIOS over TCP/IP)Debian/UbuntusambaRHEL/Fedorasambapkg: samba4xx (versioned, e.g. samba419)
TCPNetBIOS sessionFiles & sharingLegacy SMB file sharing over NetBIOS.Built in (NetBIOS over TCP/IP)Debian/UbuntusambaRHEL/Fedorasambapkg: samba4xx (versioned, e.g. samba419)
TCPIMAPMailRead mail on the server from several devices.Exchange Server (separate product)Debian/Ubuntudovecot-imapdRHEL/Fedoradovecotpkg: dovecot
UDPSNMPMonitoring & logsLets a monitor read device stats such as traffic, temperature and CPU.SNMP Service (optional feature)Debian/UbuntusnmpdRHEL/Fedoranet-snmpFreeBSD base bsnmpd · pkg: net-snmp
UDPSNMP trapMonitoring & logsReceives alerts that devices push on their own.SNMP Trap serviceDebian/UbuntusnmptrapdRHEL/Fedoranet-snmppkg: net-snmp
TCPBGPNetwork basicsRouters at ISPs and data centers exchange routes.RRAS (Remote Access role)Debian/Ubuntufrr, bird2RHEL/Fedorafrrpkg: frr10, bird2
TCPUDPLDAPDirectory & authDirectory lookups for users and groups. Active Directory speaks it too.AD DS · AD LDSDebian/UbuntuslapdRHEL/Fedora389-ds-basepkg: openldap26-server (versioned)
TCPUDPHTTPSWebEncrypted web. UDP 443 carries HTTP/3 (QUIC).IIS (Web Server role)Debian/Ubuntunginx, apache2RHEL/Fedoranginx, httpdpkg: nginx, apache24 · macOS ships httpd (Apache)
TCPSMBFiles & sharingWindows file and printer sharing.Built in (Server service, File Server)Debian/UbuntusambaRHEL/FedorasambamacOS File Sharing (built in) · FreeBSD pkg: samba4xx
TCPUDPkpasswdDirectory & authKerberos password changes.AD DS (domain controller)Debian/Ubuntukrb5-admin-serverRHEL/Fedorakrb5-serverFreeBSD base Kerberos
TCPSMTPS (submission)MailMail apps hand outgoing mail to the server inside TLS from the start.Exchange Server (separate product)Debian/UbuntupostfixRHEL/Fedorapostfixpkg: postfix
UDPIKE (IPsec)VPNIPsec VPN key exchange.RRAS (Remote Access role) · built-in IPsecDebian/Ubuntustrongswan, libreswanRHEL/Fedoralibreswanpkg: strongswan
UDPsyslogMonitoring & logsShips logs to one collector. TCP 514 is registered to rsh (shell), not syslog.None built in (uses Event Log)Debian/UbuntursyslogRHEL/FedorarsyslogBase syslogd (FreeBSD) · pkg: rsyslog
TCPSubmissionMailMail apps hand outgoing mail to the server (STARTTLS).Exchange Server (separate product)Debian/UbuntupostfixRHEL/Fedorapostfixpkg: postfix
TCPIPP (printing)Files & sharingSends print jobs to network printers.-Debian/UbuntucupsRHEL/FedoracupsmacOS built-in CUPS · FreeBSD pkg: cups
TCPLDAPSDirectory & authLDAP inside TLS.AD DS (domain controller) · with a certificateDebian/UbuntuslapdRHEL/Fedora389-ds-basepkg: openldap26-server (versioned)
TCPDNS over TLSName resolution (DNS)DNS queries wrapped in TLS so nobody on the path can read them.-Debian/UbuntuunboundRHEL/Fedoraunboundpkg: unbound
TCPrsync daemonFiles & sharingSyncs only the changed parts of files (daemon mode).-Debian/UbuntursyncRHEL/Fedorarsync-daemonpkg: rsync · macOS ships rsync
TCPFTPSFiles & sharingFTP control connection in TLS from the start (implicit).IIS FTP Server (role service)Debian/Ubuntuvsftpd, pure-ftpdRHEL/Fedoravsftpdpkg: vsftpd-ssl, pure-ftpd
TCPIMAPSMailIMAP inside TLS.Exchange Server (separate product)Debian/Ubuntudovecot-imapdRHEL/Fedoradovecotpkg: dovecot
TCPPOP3SMailPOP3 inside TLS.Exchange Server (separate product)Debian/Ubuntudovecot-pop3dRHEL/Fedoradovecotpkg: dovecot
TCPSOCKS proxyNetwork basicsGeneric proxy that relays any connection.-Debian/Ubuntudante-serverRHEL/Fedora-pkg: dante
UDPOpenVPNVPNDefault OpenVPN port (TCP also works).OpenVPN installer (separate)Debian/UbuntuopenvpnRHEL/Fedora-pkg: openvpn
TCPSQL ServerDatabasesDefault instance port for Microsoft SQL Server.SQL ServerDebian/Ubuntumssql-server (Microsoft repo)RHEL/Fedoramssql-server (Microsoft repo)-
UDPSQL Server BrowserDatabasesTells clients which port a named instance uses.SQL Server Browser serviceDebian/Ubuntu-RHEL/Fedora--
TCPOracle listener conventionDatabasesDefault Oracle Database listener. IANA lists another name here; Oracle's registered ports are 2483 and 2484.Oracle Database (Oracle installer)Debian/UbuntuOracle Database (Oracle installer)RHEL/FedoraOracle Database (Oracle installer)Oracle Database (Solaris and others)
UDPL2TPVPNOlder VPN tunnel, normally paired with IPsec.RRAS (Remote Access role)Debian/Ubuntuxl2tpdRHEL/Fedora--
TCPPPTPVPNVery old VPN protocol.RRAS (Remote Access role)Debian/Ubuntu-RHEL/Fedora--
UDPRADIUSDirectory & authCentral login checks for Wi-Fi and VPN.NPS (Network Policy Server role)Debian/UbuntufreeradiusRHEL/Fedorafreeradiuspkg: freeradius3
UDPRADIUS accountingDirectory & authReceives session accounting (who, when, how long).NPS (Network Policy Server role)Debian/UbuntufreeradiusRHEL/Fedorafreeradiuspkg: freeradius3
TCPMQTTMessaging & callsIoT devices exchange short messages.-Debian/UbuntumosquittoRHEL/Fedora-pkg: mosquitto
UDPSSDP (UPnP)Network basicsRouters, TVs and NAS boxes discover each other on the LAN.Built in (SSDP Discovery service)Debian/UbuntuminidlnaRHEL/Fedora-pkg: minidlna
TCPUDPNFSFiles & sharingUnix and Linux network file sharing.Server for NFS (role)Debian/Ubuntunfs-kernel-serverRHEL/Fedoranfs-utilsBuilt-in nfsd (FreeBSD, macOS, Solaris)
TCPZooKeeper conventionMessaging & callsCoordination for distributed systems such as older Kafka.-Debian/UbuntuzookeeperdRHEL/Fedora-pkg: zookeeper
TCPDocker APIContainers & devRemote control of the Docker engine (unencrypted).Docker DesktopDebian/Ubuntudocker.ioRHEL/Fedoradocker-ce (Docker repo)-
TCPDocker API (TLS)Containers & devDocker remote API over TLS.Docker DesktopDebian/Ubuntudocker.ioRHEL/Fedoradocker-ce (Docker repo)-
TCPetcd clientContainers & devClient port of etcd, which holds every Kubernetes setting and secret.-Debian/Ubuntuetcd-serverRHEL/Fedora-pkg: coreos-etcd35 (versioned)
TCPetcd peerContainers & devetcd members replicate with each other.-Debian/Ubuntuetcd-serverRHEL/Fedora-pkg: coreos-etcd35 (versioned)
TCPGrafana, dev servers conventionMonitoring & logsGrafana default, and a common Node.js dev server port.-Debian/Ubuntugrafana (Grafana repo)RHEL/Fedoragrafana (Grafana repo)-
TCPSquid proxy conventionWebWeb proxy and cache, often the office's exit to the web.-Debian/UbuntusquidRHEL/Fedorasquidpkg: squid
TCPiSCSIFiles & sharingAttach a remote disk as if it were local.iSCSI Target Server (role service)Debian/Ubuntutargetcli-fbRHEL/FedoratargetcliFreeBSD base ctld
TCPGlobal CatalogDirectory & authSearches the whole Active Directory forest at once.AD DS (domain controller)Debian/Ubuntusamba (AD DC mode)RHEL/Fedora--
TCPGlobal Catalog (TLS)Directory & authGlobal Catalog inside TLS.AD DS (domain controller)Debian/Ubuntusamba (AD DC mode)RHEL/Fedora--
TCPMySQL / MariaDBDatabasesMySQL and MariaDB client port.MySQL Installer (separate)Debian/Ubuntumariadb-server, mysql-serverRHEL/Fedoramariadb-server, mysql-serverpkg: mysql84-server, mariadb1011-server (versioned)
TCPUDPRDPRemote accessWindows Remote Desktop.Remote Desktop (TermService)Debian/UbuntuxrdpRHEL/Fedora-pkg: xrdp
UDPTCPSTUN / TURNMessaging & callsHelps WebRTC calls get through NAT.-Debian/UbuntucoturnRHEL/Fedora-pkg: turnserver (coturn)
UDPIPsec NAT-TVPNWraps IPsec in UDP so it works behind NAT.RRAS (Remote Access role) · built-in IPsecDebian/Ubuntustrongswan, libreswanRHEL/Fedoralibreswanpkg: strongswan
TCPDev servers, AirPlay conventionContainers & devDefault for dev servers such as Flask. From macOS 12, AirPlay Receiver uses 5000 and 7000 and may collide.-Debian/Ubuntu-RHEL/Fedora-macOS AirPlay Receiver (built in)
UDPTCPSIPMessaging & callsCall signaling for VoIP.-Debian/UbuntuasteriskRHEL/Fedora-pkg: asterisk22 (versioned)
TCPSIP (TLS)Messaging & callsSIP inside TLS.-Debian/UbuntuasteriskRHEL/Fedora-pkg: asterisk22 (versioned)
TCPXMPP clientMessaging & callsXMPP (Jabber) chat clients connect here.-Debian/Ubuntuprosody, ejabberdRHEL/Fedora-pkg: prosody, ejabberd
UDPmDNSName resolution (DNS)Finds devices as name.local on the LAN (printers, AirPlay).Built in (DNS Client service)Debian/Ubuntuavahi-daemonRHEL/FedoraavahimacOS built-in mDNSResponder · FreeBSD pkg: avahi-app
UDPLLMNRName resolution (DNS)Asks the local network for a name when DNS fails.Built in (DNS Client service)Debian/Ubuntusystemd-resolvedRHEL/Fedorasystemd-resolved-
TCPPostgreSQLDatabasesPostgreSQL client port.PostgreSQL installer (separate)Debian/UbuntupostgresqlRHEL/Fedorapostgresql-serverpkg: postgresql17-server (versioned)
TCPKibana conventionMonitoring & logsKibana dashboard for Elasticsearch data.-Debian/Ubuntukibana (Elastic repo)RHEL/Fedorakibana (Elastic repo)pkg: kibana8
TCPAMQP (RabbitMQ)Messaging & callsClient port for message queues such as RabbitMQ.-Debian/Ubunturabbitmq-serverRHEL/Fedora-pkg: rabbitmq
TCPVNCRemote accessRemote screen viewing and control.Separate install (TightVNC and others)Debian/Ubuntutigervnc-standalone-serverRHEL/Fedoratigervnc-servermacOS Screen Sharing (built in) · FreeBSD pkg: tigervnc-server
TCPWinRM (HTTP)Remote accessPowerShell remoting and remote management.Built in (WinRM service)Debian/Ubuntu-RHEL/Fedora--
TCPWinRM (HTTPS)Remote accessWinRM over HTTPS.Built in (WinRM service)Debian/Ubuntu-RHEL/Fedora--
TCPX11Remote accessDraws Unix/Linux graphics over the network (6000 to 6063).-Debian/Ubuntuxserver-xorg-coreRHEL/Fedoraxorg-x11-server-Xorgpkg: xorg-server
TCPRedisDatabasesFast in-memory store, used for caches and queues.-Debian/Ubunturedis-serverRHEL/Fedoraredispkg: redis
TCPKubernetes API conventionContainers & devKubernetes control plane API, where kubectl connects.-Debian/Ubuntukubeadm and others (Kubernetes repo)RHEL/Fedorakubeadm and others (Kubernetes repo)-
TCPsyslog over TLSMonitoring & logsShips logs inside TLS.-Debian/Ubuntursyslog-gnutls, rsyslog-opensslRHEL/Fedorarsyslog-gnutls, rsyslog-opensslpkg: rsyslog
TCPDev servers conventionContainers & devDefault for python -m http.server and the Django dev server.-Debian/Ubuntu-RHEL/Fedora--
TCPHTTP alternateWebSecond web server or proxy. Tomcat and Jenkins default.IIS (Web Server role)Debian/Ubuntutomcat10RHEL/Fedora-pkg: tomcat101
TCPHTTPS alternate conventionWebSecond HTTPS port, common for admin consoles.IIS (Web Server role)Debian/Ubuntunginx, apache2RHEL/Fedoranginx, httpdpkg: nginx, apache24 · macOS ships httpd (Apache)
TCPMQTT (TLS)Messaging & callsMQTT inside TLS.-Debian/UbuntumosquittoRHEL/Fedora-pkg: mosquitto
TCPPHP-FPM conventionWebWhere the web server hands PHP requests (FastCGI). Distro defaults often use a socket file instead.-Debian/Ubuntuphp8.3-fpm (Ubuntu 24.04)RHEL/Fedoraphp-fpmpkg: php83 (versioned)
TCPPrometheus, Cockpit conventionMonitoring & logsPrometheus UI/API default, and the port of Cockpit, the RHEL-family web console.-Debian/Ubuntuprometheus, cockpitRHEL/Fedoracockpitpkg: prometheus3
TCPKafka conventionMessaging & callsApache Kafka broker port.-Debian/UbuntuApache Kafka release (kafka.apache.org)RHEL/FedoraApache Kafka release (kafka.apache.org)pkg: kafka
TCPnode_exporter, raw printing conventionMonitoring & logsPrometheus node_exporter default. Raw (JetDirect) printing uses the same number.-Debian/Ubuntuprometheus-node-exporterRHEL/Fedora-pkg: node_exporter
TCPElasticsearch HTTP conventionDatabasesElasticsearch REST API.-Debian/Ubuntuelasticsearch (Elastic repo)RHEL/Fedoraelasticsearch (Elastic repo)pkg: elasticsearch8
TCPElasticsearch nodes conventionDatabasesElasticsearch node-to-node traffic.-Debian/Ubuntuelasticsearch (Elastic repo)RHEL/Fedoraelasticsearch (Elastic repo)pkg: elasticsearch8
TCPgit daemonContainers & devRead-only repository sharing over git://.-Debian/Ubuntugit (git daemon command)RHEL/Fedoragit-daemonpkg: git
TCPZabbix agentMonitoring & logsZabbix server polls each host here.Zabbix agent (separate install)Debian/Ubuntuzabbix-agent (Zabbix repo)RHEL/Fedorazabbix-agent (Zabbix repo)pkg: zabbix7-agent
TCPZabbix serverMonitoring & logsAgents push values to the Zabbix server.-Debian/Ubuntuzabbix-server-mysql (Zabbix repo)RHEL/Fedorazabbix-server-mysql (Zabbix repo)pkg: zabbix7-server
TCPMemcachedDatabasesIn-memory cache for frequently used values.-Debian/UbuntumemcachedRHEL/Fedoramemcachedpkg: memcached
TCPRabbitMQ management conventionMessaging & callsRabbitMQ management UI (when the plugin is on).-Debian/Ubunturabbitmq-serverRHEL/Fedora-pkg: rabbitmq
TCPMongoDBDatabasesMongoDB client port.MongoDB installer (separate)Debian/Ubuntumongodb-org (MongoDB repo)RHEL/Fedoramongodb-org (MongoDB repo)pkg: mongodb80 (versioned)
UDPWireGuard conventionVPNConventional WireGuard VPN port; not registered with IANA.WireGuard installer (separate)Debian/Ubuntuwireguard-toolsRHEL/Fedorawireguard-toolsFreeBSD kernel built in · pkg: wireguard-tools

A - in a package cell means nothing is built in, or we could not confirm a distro package name. A repo in brackets is the vendor's own repository, not the distro's.

Port number ranges

0-1023

Well-known ports

Long-standing service numbers such as SSH 22, HTTP 80 and HTTPS 443. On Linux and Unix you usually need admin rights to listen here.

1024-49151

Registered ports

Numbers vendors registered with IANA, such as MySQL 3306, RDP 3389 and PostgreSQL 5432. Registration is a convention; nothing stops other programs from using them.

49152-65535

Dynamic (ephemeral) ports

Borrowed for a moment by the side that opens a connection. When your browser connects to port 443, your end gets a number from this range.

Default ephemeral range by OS

OSDefault rangeCheck with
Windows (Vista / Server 2008 and later)49152-65535netsh int ipv4 show dynamicport tcp
Linux32768-60999sysctl net.ipv4.ip_local_port_range
FreeBSD10000-65535sysctl net.inet.ip.portrange.first net.inet.ip.portrange.last
macOS49152-65535sysctl net.inet.ip.portrange.first net.inet.ip.portrange.last
Solaris 1132768-65535ipadm show-prop -p smallest_anon_port,largest_anon_port tcp

Linux uses 32768-60999, wider than the IANA advice. Keep this range in mind when a firewall must accept return traffic.

Check a port and open the firewall

Examples use 443/TCP. Tap a row in the table to get the same commands for that port.

Is this server listening

Windows

netstat -ano | findstr :443
Get-NetTCPConnection -LocalPort 443 -State Listen

Linux

sudo ss -tlnp | grep :443

FreeBSD

sockstat -l -p 443

macOS

sudo lsof -nP -iTCP:443 -sTCP:LISTEN

Can others reach it

Windows

Test-NetConnection example.com -Port 443

Linux · Unix

nc -vz example.com 443

Open the firewall

Windows

New-NetFirewallRule -DisplayName "Allow TCP 443" -Direction Inbound -Protocol TCP -LocalPort 443 -Action Allow

ufw

sudo ufw allow 443/tcp

firewalld

sudo firewall-cmd --permanent --add-port=443/tcp
sudo firewall-cmd --reload

FreeBSD pf

pass in proto tcp from any to any port 443
sudo pfctl -f /etc/pf.conf

TCP and UDP

TCP sets up a connection first and checks order and delivery. Web, mail, SSH and databases use it because nothing may go missing.

UDP sends right away without checks. It is faster but packets can be lost. DNS queries, time sync, voice and video calls and VPNs use it.

The same number on TCP and on UDP are two different doors, and firewalls open them separately. Services such as DNS on 53 need both.

The OSI 7 layers

A reference model that splits network communication into seven layers. The sender goes down from layer 7 to layer 1, adding information at each step, and the receiver goes back up from 1 to 7.

  1. Application

    What programs send each other and the rules for it. Most service names in the table are protocols on this layer.

    HTTP (80, 443) · SMTP (25) · DNS (53) · SSH (22) · FTP (21)

  2. Presentation

    How data is represented: character encoding, compression and encryption.

    UTF-8 · JPEG · TLS encryption (often placed here)

  3. Session

    Starts, keeps and ends the conversation between two programs.

    RPC · NetBIOS session (139)

  4. Transport

    Picks the program with a port number and decides between reliable (TCP) and fast (UDP) delivery. The port numbers in this guide live on this layer.

    TCP · UDP · QUIC (over UDP)

  5. Network

    Finds the destination by IP address and routes packets across networks.

    IPv4 · IPv6 · ICMP (ping) · routers

  6. Data link

    Delivers frames to the next device on the same network by MAC address and catches errors.

    Ethernet · Wi-Fi (802.11) · ARP · switches

  7. Physical

    Turns 0s and 1s into electrical, light or radio signals and sends them.

    Network cable · fiber · radio · hubs

The internet itself runs on the TCP/IP model with four layers: application, transport, internet and network access. OSI is the common reference for saying where a problem is. If ping works but a website does not open, layer 3 is fine, so look at layer 4 (port, firewall) or layer 7 (the web server).

Questions people ask

Who decides port numbers?

IANA keeps the registry. 0-1023 are well-known, 1024-49151 are registered and 49152-65535 are dynamic. Registration is a convention, so any program can be set to listen on another number.

How do I check whether a port is open?

On the server, use netstat -ano | findstr :443 on Windows, ss -tlnp | grep :443 on Linux, sockstat -l on FreeBSD or lsof -i :443 on macOS. To test from outside, run Test-NetConnection or nc -vz from another machine.

Does changing the default port make it safe?

It only cuts down noise from automated scans. What actually protects you is limiting source IPs in the firewall and using keys or certificates instead of passwords.

Are TCP and UDP on the same number different?

Yes, they are separate doors and firewalls open them separately. Services such as DNS on 53 need both TCP and UDP.