Appendix A: Display Filter and Capture Filter Quick Reference

The Two Filter Families

Wireshark has two filter languages with different jobs. Note which box you are in: capture filters (BPF syntax) run before packets are stored and delete what they reject; display filters run after capture and only hide packets from view [29, 160]. Capture filters cannot be changed while a capture runs; display filters can [160].

Capture filter Display filter
Language BPF (libpcap/tcpdump syntax) [75, 78] Wireshark’s display-filter language [492]
Tests Raw packet bytes in the kernel, before user space [78] Fields in the decoded protocol tree [28]
Applies While capturing; permanent; rejected packets are gone [29] Anytime, reversible; applied to files too [160]
In Wireshark Filter box on the Welcome screen, or Capture > Options [29] Filter toolbar, colored green/red/yellow [78, 29]
In tshark -f "filter" [72, 493, 75] -Y "filter" [89, 492, 160]
On a saved file No: operates on live bytes only [75] Yes, with -r file -Y ... [160]
Cost Single pass, kernel-level, faster [89, 75] Per-packet dissection; risky on busy live links because you can lose packets [89]

The display filter can also express things a capture filter cannot, because its keep/drop decision can use knowledge from other packets: for example icmp.resp_not_found needs a multipass analysis, which a BPF filter has no access to [75].

Display Filter Language

A bare protocol or field name is an existence test: dns matches any packet containing DNS, and the implicit “exists” test has the highest priority of any operator [492, 114, 111].

Operators

English C-like Meaning
eq == Equal; any instance must match (any_eq) [111, 113, 114]
ne != Not equal; all instances must differ (all_ne) [113]
=== Equal; all instances must match (all_eq) [111, 113]
!== Not equal; any instance may differ (any_ne) [111, 113]
gt / lt > / < Greater / less than [113, 114]
ge / le >= / <= Greater-or-equal / less-or-equal [113, 114]
contains Field or slice contains a string or byte sequence; not usable on atomic fields such as numbers or IPs [492, 114, 111]
matches ~ PCRE2 regular expression; case-insensitive by default, (?-i) forces case [114, 111]
in {…} Set membership, with ranges: tcp.port in {80, 443, 4430..4434} [113]
& bitwise_and Bit mask test on integer fields and slices: tcp.flags & 0x02 matches SYN [111, 122]

Logical operators, highest to lowest precedence: not (!), then and (&&), then xor (^^), then or (||), all evaluated left to right; group with parentheses [111, 19]. The any/all modifiers (any ip.addr != 1.1.1.1, all tcp.port > 1024) override the equality operators [111, 114].

Slices take a sub-range of a string or byte field: [i:j] is offset+length, [i-j] is inclusive, [i] one byte, [:j] and [i:] from the ends, negative offsets count from the end (frame[-4:] == 0.1.2.3) [114, 492]. Useful functions: upper(), lower(), len(), count(), string(), max(), min(), abs() [114, 492].

Field value types

Type Syntax Example
Integer Decimal, octal (0), hex (0x), binary (0b) [111, 113] frame.len > 0x5dc [113]
Boolean 1/true or 0/false [111, 113] tcp.flags.syn == 1 [113]
IPv4 Dotted decimal, hostname, or CIDR [111, 113] ip.addr == 10.0.0.0/24 [113]
MAC / bytes Hex digits split by :, ., or - [111, 113] eth.dst == ff:ff:ff:ff:ff:ff [113]
String Double quotes; \x and octal escapes [114, 494] http.request.method == "POST" [114]
Date/time Quoted string compared with >=, <= [495] frame.time >= "2025-01-22 10:00:00" [495]

A Boolean field is present whether its value is 0 or 1. tcp.flags.syn alone matches every TCP packet that carries the flag, set or clear. Test tcp.flags.syn == 1 instead [113]. Since Wireshark 3.6, ip.addr != 10.0.0.1 means “no address equals 10.0.0.1”, so it hides every packet to or from that host [113]. Before 3.6 it meant “some address differs” and let those packets through, which is why older guides tell you to write not ip.addr eq 10.0.0.1 [122, 114]. Both forms now hide that host’s packets. They still differ on frames with no IP layer, such as ARP: != hides those too, and not ip.addr eq 10.0.0.1 keeps them. And because every comparison carries an implicit existence test, ip.dst ne 224.1.2.3 hides every non-IP frame. Use not ip.dst eq 224.1.2.3 to keep them [111, 114].

Ready-Made Display Filters

Task Display filter
One host, either direction ip.addr == 10.0.0.5 [113]
Source or destination TCP port tcp.port == 443 [115, 31]
Source port only tcp.srcport == 68 [115]
Whole subnet ip.addr == 10.0.0.0/24 [113]
New connection (SYN) tcp.flags.syn == 1 && tcp.flags.ack == 0 [205, 28]
SYN-ACK with no completed handshake tcp.flags == 0x12 && !tcp.analysis.initial_rtt [202]
Any retransmission tcp.analysis.retransmission or tcp.analysis.fast_retransmission [138]
Duplicate ACKs tcp.analysis.duplicate_ack [138]
All TCP analysis flags tcp.analysis.flags [222, 138]
DNS failures dns.flags.rcode != 0 [496, 171]
HTTP requests http.request.method == "GET" [144, 114]
TLS ClientHello / SNI tls.handshake.type == 1 [31, 29] / tls.handshake.extensions_server_name contains "example.com" [31]
HTTP/2 frame on a stream http2.streamid == 1 [497, 89]
One whole TCP conversation tcp.stream == 5 [375, 138]
Any expert note expert [225]
Text anywhere in the frame frame contains "password" [440]
Hide keep-alives !tcp.analysis.keep_alive
Hide pure ACKs (no payload) !(tcp.flags.ack == 1 && tcp.len == 0) [495]

Analysis fields such as tcp.analysis.* are inferences Wireshark draws from sequence numbers, not header values. Treat them as hints, and check the packet’s tcp.seq against the stall point before blaming the network [138, 205].

Capture Filters (BPF)

A BPF expression is one or more primitives: an id preceded by qualifiers of three kinds [77, 76]:

Kind Qualifiers
Type host, net, port, portrange [77, 76, 272]
Direction src, dst, src or dst, src and dst [77, 76]
Protocol ether, ip, ip6, arp, rarp, tcp, udp (fddi, tr, wlan alias ether) [76, 77]

Defaults: host if no type, src or dst if no direction, and all protocols consistent with the type. So port 53 means (tcp or udp) port 53 [77, 76]. Combine primitives with and, or, not, and parentheses [77, 28].

Intent Capture filter
One host host 192.168.1.1 [78]
Source host only src host 10.0.0.5 [78]
Subnet net 10.0.0.0/24 [78]
TCP service tcp port 443 [78, 28]
Well-known ports portrange 1-1024 [78]
ICMP only icmp [78]
ARP for one MAC arp and ether host 00:11:22:33:44:55 [28]
Size bounds less 100 / greater 1000 [272]
Broadcast/multicast ether broadcast, ip multicast [272]
Byte arithmetic ip and (not ip[1] & 0xfc == 0x0) [69]

Keep the capture filter broad: a habit like not port 22 preserves evidence for later display filtering, and rejected packets cannot be recovered [29]. Two limits matter: port 443 is a port number, not HTTPS, and includes UDP 443 [28]; and a host filter will not collect the client’s ARP resolution, because ARP frames carry no IP header. Collect ARP, DNS, and ICMP explicitly if adjacency evidence matters [28].

Converting Between Families

Intent Capture filter Display filter
One host host 10.10.10.10 ip.addr == 10.10.10.10
Source host src host 10.10.10.10 ip.src == 10.10.10.10
TCP service tcp port 443 tcp.port == 443
Port on either protocol port 53 tcp.port == 53 or udp.port == 53
Subnet net 10.0.0.0/24 ip.addr == 10.0.0.0/24
ICMP icmp icmp

Sources: capture-side syntax [78, 77, 28]; display-side equivalents [113, 115, 498]. The pairs match for IP traffic; BPF speaks bytes, so the capture side cannot express decoded-tree conditions such as tcp.analysis.*, and it sees only what the capture point delivers [75, 28].

1 tshark -i eth0 -f "tcp port 443" -w https.pcapng     # capture filter
2 tshark -r https.pcapng -Y "tls.handshake.type == 1"  # display filter

Source: [29, 159]. Pass the whole filter as one quoted argument; in tshark, a filter given as trailing arguments is a capture filter when capturing and a display filter when reading with -r [159, 89].

An icon indicating this blurb contains a warning

The classic failure is mixing the languages: ip.addr == 10.0.0.1 in the capture box errors, and host 10.0.0.1 in the display bar turns red [29]. The filter bar tells you: green is valid, red is invalid, yellow is valid but comes with a warning, which the status bar spells out [78].