Check If Port Is Open Windows

7 min read

Knowing how to verify network connectivity is a fundamental skill for system administrators, developers, and even power users troubleshooting application issues. When a service fails to connect, the culprit is often a blocked port—either by the Windows Firewall, a third-party antivirus, or a router upstream. Mastering the methods to check if port is open Windows environments saves hours of guesswork and helps pinpoint exactly where the communication breakdown occurs.

This guide walks you through every native and modern technique available in Windows 10 and 11, from built-in command-line tools to PowerShell scripts and GUI alternatives.

Why Checking Port Status Matters

Before diving into the commands, it helps to understand what you are checking. A port is a virtual endpoint for network communications. When you "check if a port is open," you are usually verifying one of two states:

  1. Listening (Local): An application on your machine has bound to a port and is waiting for connections (e.g., a web server on port 80).
  2. Open/Reachable (Remote): A port on a remote machine (or your own public IP) accepts connections through the firewall and network path.

Confusing these two scenarios is the most common mistake. The tools below cover both local listening ports and remote connectivity testing.

Method 1: Using Test-NetConnection (The Modern Standard)

Introduced in PowerShell 4.0, Test-NetConnection (alias tnc) is the single most powerful native tool for this job. It replaces the need for Telnet Client in almost every scenario and provides rich diagnostic output.

Basic Remote Port Check

Open PowerShell (Admin rights not strictly required for outbound tests) and run:

Test-NetConnection -ComputerName "google.com" -Port 443

Key Output Fields:

  • TcpTestSucceeded: True means the port is open and reachable. False means it is blocked, filtered, or the host is down.
  • RemoteAddress / RemotePort: Confirms the target resolved correctly (catches DNS issues).
  • PingSucceeded / PingReplyDetails (RTT): Shows if ICMP (ping) works independently of the TCP port.

Advanced Diagnostics with InformationLevel

For deep troubleshooting—like seeing exactly where a packet drops—use the InformationLevel parameter:

Test-NetConnection -ComputerName "192.168.1.50" -Port 3389 -InformationLevel "Detailed"

This outputs the full TCP handshake attempt, source/destination interface selection, and routing details. It is invaluable when you have multiple NICs (Wi-Fi + Ethernet + VPN) and need to confirm which interface Windows is trying to use Easy to understand, harder to ignore..

Testing Local Listening Ports

While Test-NetConnection targets remote hosts, you can test localhost connectivity to verify a local service is bound correctly:

Test-NetConnection -ComputerName "localhost" -Port 8080

Method 2: Netstat – The Local Listener Authority

If you need to know exactly which process is holding a port open on your machine, netstat (Network Statistics) remains the gold standard. It reads the local kernel network stack directly.

The Classic Command

Run Command Prompt or PowerShell as Administrator (required to see Process IDs/PIDs for system processes):

netstat -ano | findstr :80

Flag Breakdown:

  • -a: Show all connections and listening ports.
  • -n: Display addresses and port numbers numerically (skips slow DNS resolution).
  • -o: Display the owning Process ID (PID).
  • | findstr :80: Filters output for port 80 (change as needed).

Interpreting the Output

You will see lines like: TCP 0.0.0.0:80 0.0.0.0:0 LISTENING 4564

  • 0.0.0.0:80: Listening on all IPv4 interfaces on port 80.
  • [::]:80: Listening on all IPv6 interfaces.
  • 127.0.0.1:80: Listening only on localhost (not accessible from network).
  • LISTENING: The port is open, waiting for a connection.
  • ESTABLISHED: An active connection exists.
  • PID 4564: The Process ID.

Mapping PID to Process Name

Take the PID from the previous step and identify the application:

tasklist | findstr 4564

Or in PowerShell for cleaner output:

Get-Process -Id 4564 | Select-Object Id, ProcessName, Path

This tells you instantly if nginx.On top of that, exe, sqlservr. But exe, or chrome. exe owns the port.

Method 3: Get-NetTCPConnection (PowerShell Native Object Pipeline)

For users who prefer PowerShell objects over text parsing, Get-NetTCPConnection is the modern netstat equivalent. It outputs objects you can filter, sort, and export.

Find Listening Ports Locally

Get-NetTCPConnection -State Listen -LocalPort 80, 443, 8080 | Select-Object LocalAddress, LocalPort, State, OwningProcess, @{Name="ProcessName"; Expression={(Get-Process -Id $_.OwningProcess).ProcessName}}

This single line shows the port, the IP it's bound to (IPv4 vs IPv6), the PID, and the friendly process name without piping to tasklist.

Find Established Connections to a Specific Remote IP

Get-NetTCPConnection -State Established -RemoteAddress 192.168.1.100 | Format-Table LocalPort, RemotePort, RemoteAddress, State, OwningProcess

We're talking about excellent for auditing active sessions on a server The details matter here. Less friction, more output..

Method 4: PortQry.exe – The Legacy Heavy Lifter

While Microsoft no longer actively develops PortQry, it remains a favorite for UDP port scanning and batch scanning ranges—something native tools handle poorly. You must download it from the Microsoft Download Center (version 2.0) Easy to understand, harder to ignore..

Why Use It?

  • UDP Support: Test-NetConnection and netstat are TCP-centric. PortQry sends correctly formatted UDP payloads for common services (LDAP, DNS, RPC) to elicit a response, distinguishing "Open" from "Filtered" more accurately.
  • Port Ranges: portqry -n 192.168.1.1 -r 1:1000 scans ports 1-1000 rapidly.

Basic Usage

portqry.exe -n "target-server" -p TCP -e 1433
  • -n: Target name/IP.
  • -p: Protocol (TCP or UDP).
  • -e: Endpoint (single port).
  • -o: Order (comma separated list, e.g., -o 80,443,3389).
  • -r: Range (e.g., -r 1:1024).

Output States:

  • LISTENING: Port is open.
  • NOT LISTENING: Port is closed (TCP RST or ICMP Port Unreachable received).
  • FILTERED: No response (Firewall drop).

Method 5: The .NET / Socket Approach (No Admin, No Modules)

If you are on a locked-down machine where you cannot run scripts, load modules, or install tools, you can use the .NET Framework directly via a one

-liner using the TcpClient class. This attempts a TCP handshake and reports whether the remote endpoint accepts connections.

$tcp = New-Object System.Net.Sockets.TcpClient; $connect = $tcp.BeginConnect("127.0.0.1", 80, $null, $null); $connect.AsyncWaitHandle.WaitOne(1000, $false); if ($tcp.Connected) { Write-Host "Port 80 is OPEN" -ForegroundColor Green } else { Write-Host "

Port 80 is CLOSED or FILTERED" -ForegroundColor Red }; $tcp.Close()

The WaitOne(1000, $false) call is the important part—it caps the wait at one second so you don't hang on a filtered port that silently drops packets. Without it, a firewalled target could stall the script for the default timeout of roughly 21 seconds That's the part that actually makes a difference..

Wrapping It Into a Reusable One-Liner Function

Pasting that raw line repeatedly gets ugly. Define it once per session:

function Test-Port {
    param([string]$Target = "127.0.0.1", [int]$Port = 80, [int]$TimeoutMs = 1000)
    $tcp = New-Object System.Net.Sockets.TcpClient
    try {
        $async = $tcp.BeginConnect($Target, $Port, $null, $null)
        if ($async.AsyncWaitHandle.WaitOne($TimeoutMs, $false) -and $tcp.Connected) {
            [PSCustomObject]@{ Target = $Target; Port = $Port; State = "OPEN" }
        } else {
            [PSCustomObject]@{ Target = $Target; Port = $Port; State = "CLOSED/FILTERED" }
        }
    } finally {
        $tcp.Close()
    }
}

Test-Port -Target 192.168.1.10 -Port 3389

Because this relies only on the .NET Framework baked into Windows, it works in a bare powershell.exe session with no modules, no admin rights, and no external binaries. It is the lowest-common-denominator method when everything else is locked down.

Choosing the Right Tool

The "best" method depends entirely on your constraints:

  • Interactive troubleshooting on your own box → netstat -ano or Get-NetTCPConnection. Fast, native, no setup.
  • Reachability testing from a client → Test-NetConnection (or tnc). It bundles ping, port, and route info in one object.
  • UDP services or scanning ranges → PortQry.exe. Nothing native matches its UDP accuracy.
  • Locked-down, script-restricted environments → the raw TcpClient .NET approach. Zero dependencies.

Conclusion

Checking whether a port is open on Windows is not a single command but a family of tools, each with a sweet spot. On the flip side, for remote probing, Test-NetConnection gives you the quickest yes/no answer, while PortQry. And when policy or permissions strip away everything else, a short .exe remains the specialist for UDP and batch range scans. For local inspection, Get-NetTCPConnection has effectively replaced the old netstat and tasklist pipeline with clean, filterable objects. NET TcpClient snippet still gets the job done with nothing but the framework itself.

The practical takeaway is to keep more than one method in your toolkit. Knowing the strengths and failure modes of each technique lets you cross-check results and reach a confident conclusion instead of guessing. Start with the native cmdlets, fall back to PortQry for the awkward cases, and keep the .Real-world diagnostics rarely cooperate with a single approach: a firewall may make TCP probes look "closed," a service may only speak UDP, or a hardened host may block the very modules you rely on. NET one-liner in your back pocket for the environments that fight back.

Up Next

New Arrivals

Try These Next

While You're Here

Thank you for reading about Check If Port Is Open Windows. We hope the information has been useful. Feel free to contact us if you have any questions. See you next time — don't forget to bookmark!
⌂ Back to Home