Wireshark Filters Cheat Sheet: Display and Capture Filters Explained [Interactive Lab]

PRACTICAL LEARNING6 min read

Wireshark filters come in two kinds. Display filters, typed into the green bar above the packet list, hide packets you do not want to see, for example ip.addr == 192.168.1.20 or dns. Capture filters, set before you start capturing, decide which packets are recorded at all, for example host 192.168.1.20 or port 53. They use different syntax, and mixing them up is the most common Wireshark mistake.

This page is a practical Wireshark filters cheat sheet. Start with the interactive lab: build a filter and get both versions, then test filters against a small capture that contains a port scan. Only capture traffic on networks you own or are authorised to monitor.

Interactive Wireshark lab

In Lab 1, choose a protocol, IP address and port and get the display filter, the capture filter and an explanation. In Lab 2, click a filter and see which packets of a sample capture stay visible.

Lab 1 ยท Filter builder
Build a Wireshark filter and see the capture filter too
Choose what you are looking for. You get the display filter for Wireshark’s filter bar, the matching capture filter (BPF) for tcpdump or the capture options, and an explanation of every part.
Protocol
IP address
IP direction
Port
Extra conditions
Display filter (Wireshark filter bar)

    
Capture filter (tcpdump / capture options)

    
    Lab 2 ยท Which packets match?
    Apply a filter to a real-looking capture
    This small capture contains normal web browsing, DNS, a port scan, a retransmission and ARP. Click a filter and watch which packets stay visible.
    No.SourceDestinationProtocolInfo

    Display filters vs capture filters

    Display filterCapture filter
    When it appliesAfter capturing. Packets are only hiddenBefore capturing. Packets that do not match are never saved
    SyntaxWireshark fields, e.g. tcp.port == 443BPF (same as tcpdump), e.g. tcp port 443
    Where you type itThe filter bar above the packet listCapture options, or tcpdump -f / tshark -f
    Can you undo it?Yes, clear the filterNo, unmatched packets are gone
    Use it forAnalysis, almost alwaysBusy networks or long captures where disk space matters

    Rule of thumb: capture broadly, then narrow down with display filters. Only use a capture filter when you are sure what you need.

    Wireshark display filters cheat sheet

    Addresses and ports

    FilterShows
    ip.addr == 192.168.1.20Packets to or from this IP address
    ip.src == 192.168.1.20Packets sent by this address
    ip.dst == 192.168.1.20Packets sent to this address
    ip.addr == 10.0.0.0/8Any address in a subnet
    !(ip.addr == 192.168.1.20)Everything except this address
    tcp.port == 443TCP port 443 as source or destination
    udp.port == 53UDP port 53 as source or destination
    tcp.port in {80, 443, 8080}Any of several ports (Wireshark 4.x syntax)
    eth.addr == 00:11:22:33:44:55A MAC address

    Protocols

    FilterShows
    http.requestHTTP requests only
    http.request.method == "POST"HTTP POST requests, for example form logins
    http.response.code >= 400HTTP errors
    dns.qry.name contains "example"DNS queries for names containing a word
    dns.flags.rcode != 0DNS errors such as NXDOMAIN
    tls.handshake.type == 1TLS Client Hello messages
    tls.handshake.extensions_server_name contains "example"TLS connections to a server name (SNI)
    icmp.type == 8Ping requests
    arpARP requests and replies
    dhcpDHCP (called bootp before Wireshark 3.0)

    Troubleshooting and threat hunting

    FilterShows
    tcp.analysis.flagsEvery packet Wireshark marked as a TCP problem
    tcp.analysis.retransmissionRetransmitted packets (loss or congestion)
    tcp.analysis.zero_windowA receiver that cannot keep up
    tcp.flags.syn == 1 and tcp.flags.ack == 0New connection attempts. Many from one host means a scan
    tcp.flags.reset == 1Resets: closed ports or abruptly ended connections
    frame contains "password"Any packet containing a text string
    tcp.stream eq 4One TCP conversation (what Follow TCP Stream uses)
    frame.time_delta_displayed > 1Gaps of more than a second between displayed packets

    Operators: == (or eq), !=, >, <, contains, matches (regular expression), and and, or, not. A green filter bar means the filter is valid, red means a syntax error.

    A classic trap: in Wireshark versions before 3.6, ip.addr != 192.168.1.20 does not hide that address, because every packet has a source and a destination and one of them is always different. Use !(ip.addr == 192.168.1.20), which works in every version.

    Capture filters (BPF) cheat sheet

    Capture filterRecords
    host 192.168.1.20Traffic to or from one host
    src host 192.168.1.20Traffic from one host
    net 192.168.1.0/24Traffic to or from a subnet
    port 53TCP or UDP port 53
    tcp port 443TCP port 443 only
    portrange 1-1024A range of ports
    not arp and not broadcastEverything except ARP and broadcasts
    tcp[tcpflags] & (tcp-syn|tcp-ack) == tcp-synOnly TCP SYN packets without ACK

    The same filters work with tcpdump and tshark, which is handy on servers without a screen:

    # capture DNS on eth0 into a file
    sudo tcpdump -i eth0 -w dns.pcap port 53
    
    # read a capture with a display filter in tshark
    tshark -r dns.pcap -Y "dns.qry.name contains \"example\""
    
    # list TCP conversations in a capture
    tshark -r capture.pcapng -q -z conv,tcp

    Find a port scan in four steps

    1. Open Statistics > Conversations and sort the TCP tab by the number of packets. A scanner talks to one host on many ports.
    2. Apply tcp.flags.syn == 1 and tcp.flags.ack == 0 to see only connection attempts.
    3. Add ip.src == <scanner> and look at the destination ports. Sequential or very many ports in seconds is a scan.
    4. Apply tcp.flags.reset == 1 to see which ports were closed. SYN/ACK replies show the open ones.

    To see what a scanner like Nmap reports for the same packets, read the Nmap cheat sheet and port states lab.

    Frequently asked questions

    How do I filter by IP address in Wireshark?

    Type ip.addr == 192.168.1.20 in the display filter bar to see packets to or from that address. Use ip.src or ip.dst to match only the sender or only the receiver, and ip.addr == 192.168.1.0/24 to match a whole subnet.

    What is the difference between a display filter and a capture filter?

    A capture filter decides which packets Wireshark records and uses tcpdump (BPF) syntax, such as host 10.0.0.5. A display filter only hides packets that were already captured and uses Wireshark field names, such as ip.addr == 10.0.0.5. Packets dropped by a capture filter cannot be recovered.

    How do I filter HTTP traffic in Wireshark?

    Use http to show all HTTP packets, http.request to show only requests, or http.request.method == "POST" for POST requests. Encrypted HTTPS traffic shows up as tls instead, because Wireshark cannot read it without the session keys.

    How do I exclude an IP address in Wireshark?

    Use !(ip.addr == 192.168.1.20). In Wireshark versions before 3.6, ip.addr != 192.168.1.20 does not work as expected because it matches every packet where either address differs.

    Why is my Wireshark filter bar red?

    A red filter bar means the filter has a syntax error, for example a misspelled field name or a capture filter typed into the display filter bar. A green bar means the filter is valid. Yellow means it is valid but may not do what you expect.

    Wireshark is a legal, widely used network analysis tool. Capturing traffic on networks you do not own or are not authorised to monitor can break privacy and computer misuse laws. Practise on your own network or on public sample captures.

    Where to go next

    This cheat sheet covers the filters you need every day. How packets move through the OSI layers, capture options, tcpdump and tshark, and step-by-step analysis of ARP, IP, TCP, UDP, DNS, DHCP and HTTP are covered lesson by lesson in Wireshark for Packet Analysis.