188

How do I find which program is using port 80 in Windows?

I can't find it.

Peter Mortensen
  • 28,342
  • 21
  • 95
  • 123
user198729
  • 55,886
  • 102
  • 239
  • 342

6 Answers6

209

Start menu → Accessories → right click on "Command prompt". In the menu, click "Run as Administrator" (on Windows XP you can just run it as usual), run netstat -anb, and then look through output for your program.

BTW, Skype by default tries to use ports 80 and 443 for incoming connections.

You can also run netstat -anb >%USERPROFILE%\ports.txt followed by start %USERPROFILE%\ports.txt to open the port and process list in a text editor, where you can search for the information you want.

You can also use PowerShell to parse netstat output and present it in a better way (or process it any way you want):

$proc = @{};
Get-Process | ForEach-Object { $proc.Add($_.Id, $_) };
netstat -aon | Select-String "\s*([^\s]+)\s+([^\s]+):([^\s]+)\s+([^\s]+):([^\s]+)\s+([^\s]+)?\s+([^\s]+)" | ForEach-Object {
    $g = $_.Matches[0].Groups;
    New-Object PSObject |
        Add-Member @{ Protocol =           $g[1].Value  } -PassThru |
        Add-Member @{ LocalAddress =       $g[2].Value  } -PassThru |
        Add-Member @{ LocalPort =     [int]$g[3].Value  } -PassThru |
        Add-Member @{ RemoteAddress =      $g[4].Value  } -PassThru |
        Add-Member @{ RemotePort =         $g[5].Value  } -PassThru |
        Add-Member @{ State =              $g[6].Value  } -PassThru |
        Add-Member @{ PID =           [int]$g[7].Value  } -PassThru |
        Add-Member @{ Process = $proc[[int]$g[7].Value] } -PassThru;
#} | Format-Table Protocol,LocalAddress,LocalPort,RemoteAddress,RemotePort,State -GroupBy @{Name='Process';Expression={$p=$_.Process;@{$True=$p.ProcessName; $False=$p.MainModule.FileName}[$p.MainModule -eq $Null] + ' PID: ' + $p.Id}} -AutoSize
} | Sort-Object PID | Out-GridView

Also it does not require elevation to run.

Peter Mortensen
  • 28,342
  • 21
  • 95
  • 123
n0rd
  • 9,674
  • 3
  • 31
  • 50
  • It'll output too much,but I only want information about port 80 – user198729 Dec 25 '09 at 08:10
  • 152
    netstat -anb | findstr :80 – Anton Tykhyy Dec 25 '09 at 08:12
  • 3
    Then you either need to watch through list carefully or install some additional software. http://technet.microsoft.com/en-us/sysinternals/bb897437.aspx for example. – n0rd Dec 25 '09 at 08:14
  • 8
    Anton, it will chop process names. – n0rd Dec 25 '09 at 08:15
  • 3
    @Anton Tykhyy,this way I can't see the programme name,just numbers. – user198729 Dec 25 '09 at 08:15
  • Initially (not sure about current situation) Skype was using peer-to-peer connections for calls and chats: this way they don't need huge infrastructure to support millions of clients, so clients attempt to connect directly to each other. Ports 80 and 443 are less likely to be blocked for incoming connections, so they attempt to use it where possible. – n0rd Jan 04 '15 at 23:31
206

Type in the command:

netstat -aon | findstr :80

It will show you all processes that use port 80. Notice the pid (process id) in the right column.

If you would like to free the port, go to Task Manager, sort by pid and close those processes.

-a displays all connections and listening ports.

-o displays the owning process ID associated with each connection.

-n displays addresses and port numbers in numerical form.

Peter Mortensen
  • 28,342
  • 21
  • 95
  • 123
Technotronic
  • 7,011
  • 3
  • 35
  • 51
14

If you want to be really fancy, download TCPView from Sysinternals:

TCPView is a Windows program that will show you detailed listings of all TCP and UDP endpoints on your system, including the local and remote addresses and state of TCP connections. On Windows Server 2008, Vista, and XP, TCPView also reports the name of the process that owns the endpoint. TCPView provides a more informative and conveniently presented subset of the Netstat program that ships with Windows.

Peter Mortensen
  • 28,342
  • 21
  • 95
  • 123
Manu
  • 27,156
  • 27
  • 70
  • 82
12

Use this nifty freeware utility:

CurrPorts is network monitoring software that displays the list of all currently opened TCP/IP and UDP ports on your local computer.

Enter image description here

Peter Mortensen
  • 28,342
  • 21
  • 95
  • 123
Marcelo Mason
  • 5,862
  • 2
  • 31
  • 41
10

Right click on "Command prompt" or "PowerShell", in menu click "Run as Administrator" (on Windows XP you can just run it as usual).

As Rick Vanover mentions in See what process is using a TCP port in Windows Server 2008

The following command will show what network traffic is in use at the port level:

Netstat -a -n -o

or

Netstat -a -n -o >%USERPROFILE%\ports.txt

(to open the port and process list in a text editor, where you can search for information you want)

Then,

with the PIDs listed in the netstat output, you can follow up with the Windows Task Manager (taskmgr.exe) or run a script with a specific PID that is using a port from the previous step. You can then use the "tasklist" command with the specific PID that corresponds to a port in question.

Example:

tasklist /svc /FI "PID eq 1348"
Bhargav Rao
  • 41,091
  • 27
  • 112
  • 129
Quang Trinh
  • 109
  • 1
  • 3
3

Use NETSTAT on the command-line:

netstat util
Peter Mortensen
  • 28,342
  • 21
  • 95
  • 123
denisenkom
  • 403
  • 2
  • 3
  • This will only display the help text (with all the different options/switches). Which option should be used? Should it be `-a` - *"-a Display All connections and listening ports."*? – Peter Mortensen Nov 14 '19 at 13:26
  • Or [`-a -n -o`](https://stackoverflow.com/questions/1960750/how-do-i-find-which-program-is-using-port-80-in-windows/20509221#20509221)? – Peter Mortensen Nov 14 '19 at 13:32