The ping command operates by sending Internet Control Message Protocol (ICMP) Echo Request messages to the destination computer and waiting for a response. The two major pieces of information that the ping command provides are how many of those responses are returned and how long it takes for them to return. For example, you might find no responses when pinging a network printer, only to find out that the printer is offline and its cable needs replaced. Or maybe you need to ping a router to verify that your computer can connect to it to eliminate it as a possible cause for a networking issue.

Ping Command Availability

The ping command is available from the Command Prompt in Windows 11, Windows 10, Windows 8, Windows 7, Windows Vista, and Windows XP operating systems. It’s also available in older versions of Windows like Windows 98 and 95. This command can also be found in Command Prompt in the Advanced Startup Options and System Recovery Options repair/recovery menus.

Ping Command Syntax

ping [-t] [-a] [-n count] [-l size] [-f] [-i TTL] [-v TOS] [-r count] [-s count] [-w timeout] [-R] [-S srcaddr] [-p] [-4] [-6] target [/?]

Ping Command Examples

Below are several examples of commands that use ping.

Ping Google.com

In this example, the ping command is used to ping the hostname www.google.com. The -n option tells the ping command to send 5 ICMP Echo Requests instead of the default of 4, and the -l option sets the packet size for each request to 1500 bytes instead of the default of 32 bytes. The result displayed in the Command Prompt window will look something like this: The 0% loss reported under Ping statistics for 74.217.1.142 explains that each ICMP Echo Request message sent to www.google.com was returned. This means that, as far as this network connection goes, it can communicate with Google’s website just fine.

Ping localhost

In the above example, we’re pinging 127.0.0.1, also called the IPv4 localhost IP address or IPv4 loopback IP address, without options. Using the ping command with this address is an excellent way to test that Windows’ network features are working properly but it says nothing about your own network hardware or your connection to any other computer or device. The IPv6 version of this test would be ping ::1.

Find Hostname With Ping

In this example, we’re asking the ping command to find the hostname assigned to the 192.168.1.22 IP address, but to otherwise ping it as normal. The command might resolve the IP address, 192.168.1.22, as the hostname J3RTY22, for example, and then execute the remainder of the ping with default settings.

Ping Router Command

Similar to the ping command examples above, this one is used to see if your computer can reach your router. The only difference here is that instead of using a ping command switch or pinging the localhost, we’re checking the connection between the computer and the router (192.168.2.1 in this case). If you’re having trouble logging in to your router or accessing the internet at all, see if your router is accessible with this ping command, of course, replacing 192.168.2.1 with your router’s IP address.

Ping With IPv6

In this example, we force the ping command to use IPv6 with the -6 option and continue to ping SERVER indefinitely with the -t option. You can interrupt the ping manually with Ctrl+C.

The ping command is often used with other networking related Command Prompt commands like tracert, ipconfig, netstat, and nslookup.

Other Ping Uses

Given the results you see above, it’s clear that you can also use the ping command to find a website’s IP address. Follow that link to learn more about how to do that. You can also use ping on a Linux computer, and third-party ping tools exist as well which offer more features than the basic ping command.