ping google.com on any OS to test your connection. On Windows it sends 4 packets by default; on Linux/Mac it runs until you press Ctrl+C. Use ping -c 10 8.8.8.8 for a 10-packet test. Want the no-install version? Try our web ping tool.Ping command basics
The ping command is one of the most fundamental network troubleshooting tools available on every operating system. It sends small packets to a target and measures how long it takes to get a response, helping you diagnose connectivity issues, measure latency, and verify network paths.
Quick start for the impatient:
- Windows:
ping google.com - Linux:
ping -c 4 google.com - Mac:
ping -c 4 google.com
Windows ping command
Basic syntax:
ping [options] hostname_or_ip
Essential Windows ping options
| Option | Description | Example |
|---|---|---|
-t | Continuous ping (until stopped with Ctrl+C) | ping -t google.com |
-n count | Number of ping packets to send | ping -n 10 google.com |
-l size | Packet size in bytes (default 32) | ping -l 1000 google.com |
-w timeout | Timeout in milliseconds | ping -w 5000 google.com |
-4 | Force IPv4 | ping -4 google.com |
-6 | Force IPv6 | ping -6 google.com |
Windows ping examples
1. Basic ping (4 packets by default):
C:\> ping google.com
Pinging google.com [142.250.191.78] with 32 bytes of data:
Reply from 142.250.191.78: bytes=32 time=23ms TTL=117
Reply from 142.250.191.78: bytes=32 time=24ms TTL=117
Reply from 142.250.191.78: bytes=32 time=22ms TTL=117
Reply from 142.250.191.78: bytes=32 time=25ms TTL=117
Ping statistics for 142.250.191.78:
Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),
Approximate round trip times in milli-seconds:
Minimum = 22ms, Maximum = 25ms, Average = 23ms
2. Continuous ping:
ping -t google.com # Pings continuously until Ctrl+C
3. Large packet size test:
ping -l 1472 google.com # Tests with larger packets to check MTU
4. Multiple pings with custom count:
ping -n 20 google.com # Sends exactly 20 ping packets
Linux ping command
Basic syntax:
ping [options] hostname_or_ip
-t). Use -c to specify count or Ctrl+C to stop.Essential Linux ping options
| Option | Description | Example |
|---|---|---|
-c count | Number of ping packets to send | ping -c 5 google.com |
-i interval | Interval between packets (seconds) | ping -i 2 google.com |
-s size | Packet size in bytes | ping -s 1000 google.com |
-W timeout | Timeout in seconds | ping -W 5 google.com |
-f | Flood ping (requires root) | sudo ping -f google.com |
-q | Quiet mode (only summary) | ping -q -c 10 google.com |
-n | No DNS resolution (numeric only) | ping -n 8.8.8.8 |
Linux ping examples
1. Basic ping with count:
$ ping -c 4 google.com
PING google.com (142.250.191.78) 56(84) bytes of data.
64 bytes from lga25s62-in-f14.1e100.net (142.250.191.78): icmp_seq=1 time=23.2 ms
64 bytes from lga25s62-in-f14.1e100.net (142.250.191.78): icmp_seq=2 time=24.1 ms
64 bytes from lga25s62-in-f14.1e100.net (142.250.191.78): icmp_seq=3 time=22.8 ms
64 bytes from lga25s62-in-f14.1e100.net (142.250.191.78): icmp_seq=4 time=23.5 ms
--- google.com ping statistics ---
4 packets transmitted, 4 received, 0% packet loss, time 3004ms
rtt min/avg/max/mdev = 22.815/23.400/24.134/0.504 ms
2. Quiet mode with statistics only:
ping -q -c 10 google.com
3. Custom packet size and interval:
ping -c 5 -s 1000 -i 2 google.com # 5 packets, 1000 bytes, 2s intervals
4. IPv6 ping:
ping6 google.com # or: ping -6 google.com
Mac ping command
Mac ping is based on BSD Unix and is very similar to Linux, with a few differences in options and behaviour.
Mac-specific ping options
| Option | Description | Mac-specific notes |
|---|---|---|
-c count | Number of packets | Same as Linux |
-i interval | Wait interval | Minimum 1 second for non-root |
-s packetsize | Data bytes to send | Default 56 bytes |
-t timeout | Timeout in seconds | Different from Linux -W |
-o | Exit after first reply | Mac-specific option |
-D | Print timestamps | Mac-specific format |
Mac ping examples
$ ping -c 4 google.com
PING google.com (142.250.191.78): 56 data bytes
64 bytes from 142.250.191.78: icmp_seq=0 time=23.234 ms
64 bytes from 142.250.191.78: icmp_seq=1 time=24.123 ms
64 bytes from 142.250.191.78: icmp_seq=2 time=22.891 ms
64 bytes from 142.250.191.78: icmp_seq=3 time=23.567 ms
--- google.com ping statistics ---
4 packets transmitted, 4 packets received, 0.0% packet loss
round-trip min/avg/max/stddev = 22.891/23.454/24.123/0.456 ms
Single ping (exit after first reply):
ping -o google.com
Ping with timestamps:
ping -D -c 3 google.com
Mac GUI alternative: you can also use Network Utility (Applications > Utilities > Network Utility) for a graphical ping interface.
Cross-platform comparison
| Feature | Windows | Linux | Mac |
|---|---|---|---|
| Default behaviour | 4 packets then stop | Continuous until Ctrl+C | Continuous until Ctrl+C |
| Count option | -n count | -c count | -c count |
| Packet size | -l size | -s size | -s size |
| Timeout | -w ms | -W seconds | -t seconds |
| Continuous | -t | default | default |
| IPv6 | -6 | ping6 or -6 | ping6 |
| Flood ping | Not available | -f (root) | -f (root) |
Advanced ping techniques
Universal ping commands that work everywhere
# Basic connectivity test (adjust count option per platform)
Windows: ping google.com
Linux/Mac: ping -c 4 google.com
# Test specific IP (no DNS lookup needed)
ping 8.8.8.8
# Test with larger packets (MTU discovery)
Windows: ping -l 1472 google.com
Linux/Mac: ping -s 1472 -c 4 google.com
Network discovery with ping sweeps
Windows (PowerShell):
1..254 | ForEach-Object {
ping -n 1 192.168.1.$_ | Select-String "Reply"
}
Linux/Mac (Bash):
for i in {1..254}; do
ping -c1 192.168.1.$i | grep "64 bytes"
done
Monitoring network quality
# Windows — log ping results
ping -t google.com > ping_log.txt
# Linux — statistical summary
ping -c 100 google.com | awk '/transmitted/ {print $0}'
# Mac — timestamped continuous monitoring
ping -D google.com | tee ping_results.log
MTU path discovery
# Find maximum MTU size (start high and work down)
Windows: ping -f -l 1472 google.com
Linux: ping -M do -s 1472 -c 1 google.com
Mac: ping -D -s 1472 -c 1 google.com
# If this fails, try smaller sizes: 1200, 1000, 800, etc.
Testing different protocols and servers
# Test IPv4 vs IPv6 performance
ping google.com # Usually IPv4
ping6 google.com # Force IPv6 (Linux/Mac)
ping -6 google.com # Force IPv6 (Windows)
# Test multiple DNS servers
ping 8.8.8.8 # Google DNS
ping 1.1.1.1 # Cloudflare DNS
ping 208.67.222.222 # OpenDNS
Interpreting ping results
Good ping results:
- Low latency — under 50ms for most activities.
- Consistent times — little variation between pings.
- No packet loss — 0% loss indicates stable connection.
- Reasonable TTL — shows reasonable hop count.
Problematic results:
- High latency — over 100ms for local services.
- Variable times — large differences between pings.
- Packet loss — any percentage indicates problems.
- "Request timed out" — network or firewall issues.
Common error messages
| Error message | Likely cause | What to check |
|---|---|---|
| "Request timed out" | Firewall blocking or destination down | Firewall settings, target server status |
| "Destination host unreachable" | Routing problem | Network configuration, routing tables |
| "Could not find host" | DNS resolution failure | DNS settings, hostname spelling |
| "Network is unreachable" | No route to destination | Default gateway, network connectivity |
| "TTL expired in transit" | Too many hops or routing loop | Routing configuration, use traceroute |
Ping troubleshooting workflow
Systematic troubleshooting steps:
- Test localhost:
ping 127.0.0.1(tests TCP/IP stack). - Test default gateway:
ping [gateway IP](tests local network). - Test external IP:
ping 8.8.8.8(tests internet connectivity). - Test external hostname:
ping google.com(tests DNS resolution). - Test target specifically:
ping [your target].
If any of these fail, you know exactly where the problem is. Compare against our web-based ping tool running from a different network — if our tool can reach your target but you can't, the issue is on your side.
Related reading: What is ping? · Complete ping testing guide · Network diagnostics — professional troubleshooting