What Are TCP Communication Flags? A Guide to TCP Header Flags (SYN, ACK, FIN, RST, PSH, URG)

TCP communication flags are essential parts of the TCP header that govern the lifecycle of a TCP connection, from initiation using SYN, acknowledgment with ACK, graceful termination using FIN, abrupt termination using RST, to special instructions via PSH and URG. Each of these 1-bit control flags plays a critical role in managing data transmission and session control between hosts. These flags are important for developers and network engineers, and also for ethical hackers, penetration testers, and cybersecurity analysts who analyze packet behavior and detect anomalies using tools like Wireshark and Nmap. In this blog, we’ve explored the structure, function, and real-time use cases of TCP flags along with a breakdown of the TCP header format and diagrams for better understanding. Here are 30 frequently asked questions to clear all your doubts about TCP flags.

Apr 09, 2025 - 10:47
Updated: 1 month ago
110.3k
What Are TCP Communication Flags? A Guide to TCP Header Flags (SYN, ACK, FIN, RST, PSH, URG)

Quick answer: TCP flags are single-bit control fields in the TCP header that manage a connection's life cycle. The six you need to know are SYN (start a connection), ACK (confirm received data), FIN (close politely), RST (abort at once), PSH (deliver buffered data now) and URG (mark data as urgent). More than one flag can be set in the same segment, which is why a handshake reply shows SYN and ACK together.

Key takeaways

  • Memorise the handshake as SYN, SYN-ACK, ACK, and recognise FIN for graceful close and RST for abrupt reset.
  • Combinations such as SYN with FIN, or no flags at all, are abnormal and often point to scanning or crafted packets.
  • Practise reading flags in a Wireshark capture or tcpdump, since CCNA, Security+ and SOC interviews all expect this.

Every reliable connection on the internet, from loading a web page to an SSH session, is steered by these flag bits. Reading them is a core skill for network engineers, SOC analysts and anyone preparing for CCNA or Security+, because packet captures and firewall logs are full of them.

What are TCP flags?

TCP flags are control bits in the TCP header that tell each side what a segment is for. The modern TCP header carries a set of control bits; the six listed below handle the everyday work of opening, running and closing a connection. Each bit is either 1 (set) or 0 (not set), and several can be set at once.

Two older bits, CWR and ECE, support Explicit Congestion Notification. A further bit in the same byte, historically "reserved", was assigned to the experimental ECN nonce (NS) and later returned to reserved. You rarely touch these in day-to-day work, so this guide focuses on the six control flags.

What do the six main TCP flags do?

Each flag signals one kind of event. The table gives the short version; the notes after it add the detail that matters in practice.

FlagNameSignalsTypical moment
SYNSynchroniseStart a connection and agree initial sequence numbersFirst packet of the handshake
ACKAcknowledgementThe acknowledgement number is valid; data receivedAlmost every packet after the first SYN
FINFinishThis side has no more data and wants to closeGraceful shutdown
RSTResetAbort the connection immediatelyPacket to a closed port, or an unexpected state
PSHPushPass buffered data to the application nowInteractive traffic such as SSH keystrokes
URGUrgentThe urgent pointer field marks priority dataRare; some legacy Telnet control signals
  • SYN only appears when a connection is being set up. A second SYN on an established connection is abnormal and often flagged by security tools.
  • ACK is set on nearly all segments once the handshake is done, because TCP acknowledges data continuously. A packet with ACK but no SYN or FIN is usually ordinary data or a plain acknowledgement.
  • FIN closes one direction at a time. A full close needs a FIN and an ACK from each side, so you often see four packets at the end of a connection.
  • RST skips the polite close. It is normal when you connect to a port nothing is listening on, and it is what lets a firewall or host cut a session dead.
  • PSH tells the receiver not to wait for its buffer to fill before handing data up to the application. Interactive protocols set it so each keystroke or message arrives without delay.
  • URG is almost extinct. Modern applications avoid the urgent pointer, and some middleboxes clear the bit, so treat unexpected URG traffic with suspicion.

The control bits live in byte 13 of the TCP header, just after the data offset and reserved bits and before the window size. This layout follows the order defined in the TCP specification (RFC 9293), which now consolidates the original RFC 793.

 0 1 2 3
 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| Source Port | Destination Port |
+---------------------------------------------------------------+
| Sequence Number |
+---------------------------------------------------------------+
| Acknowledgement Number |
+-------+-----------+-+-+-+-+-+-+---------------------------------+
| Data | Reserved |U|A|P|R|S|F| Window Size |
| Offset| |R|C|S|S|Y|I| |
| | |G|K|H|T|N|N| |
+-------+-----------+-+-+-+-+-+-+---------------------------------+
| Checksum | Urgent Pointer |
+---------------------------------------------------------------+
| Options and Padding |
+---------------------------------------------------------------+

Each flag is one bit, so the whole set fits in part of a single byte. When you read a capture, the tool decodes these bits for you, but knowing the position helps when you write filters by hand.

How do flags drive the 3-way handshake?

Opening a TCP connection takes three segments, each defined by its flags:

  1. SYN: the client sends a segment with SYN set and its initial sequence number.
  2. SYN-ACK: the server replies with both SYN and ACK set, acknowledging the client and sending its own sequence number. This is the clearest example of two flags in one segment.
  3. ACK: the client acknowledges the server's SYN. The connection is now established and data can flow.

Closing is the mirror image. One side sends FIN, the other acknowledges with ACK, then sends its own FIN, which the first side acknowledges. If anything goes wrong in between, either side can send RST to tear the connection down at once. If you want the layer-by-layer context behind this, see our explainer on the difference between IP, TCP and UDP.

Which flag combinations are normal, and which are not?

Recognising unusual combinations is where this knowledge earns its keep.

Flags setMeaningNormal?
SYNConnection requestYes, first packet only
SYN, ACKConnection acceptedYes, handshake reply
ACKData or acknowledgementYes, most packets
PSH, ACKDeliver this data nowYes, interactive traffic
FIN, ACKClose request with acknowledgementYes, end of session
RST or RST, ACKConnection refused or abortedYes, but worth noticing
No flags set (NULL)Empty control fieldNo, abnormal
FIN, PSH, URG togetherOdd mix with no handshakeNo, abnormal
SYN, FIN togetherContradictory (open and close)No, abnormal

The abnormal rows matter in practice. Older port-scanning techniques deliberately craft packets with no flags, or with FIN/PSH/URG together, to probe how a host responds. A healthy network should rarely see them, so intrusion-detection rules often alert on exactly these patterns.

How do you see TCP flags yourself?

The fastest way to understand flags is to watch them. Capture a little traffic and filter on the flags.

In tcpdump, match SYN-only packets (new connection attempts):

sudo tcpdump 'tcp[tcpflags] == tcp-syn' -n -i any

Match SYN or ACK packets, the bulk of a handshake:

sudo tcpdump 'tcp[tcpflags] & (tcp-syn|tcp-ack)!= 0' -n

In Wireshark, use display filters instead:

tcp.flags.syn == 1 && tcp.flags.ack == 0 # new connection requests
tcp.flags.reset == 1 # resets
tcp.flags == 0x012 # exactly SYN+ACK

Load a capture, follow a single connection, and you will see the SYN, SYN-ACK, ACK sequence at the start and the FIN or RST at the end. Our guides to Wireshark for beginners and Nmap for network scanning show how to generate and read this traffic safely in a lab.

Why do TCP flags matter in security?

Flags are central to both attacks and defences, which is why they appear throughout the CCNA and Security+ syllabuses.

  • SYN floods: an attacker sends many SYN packets and never completes the handshake, filling the server's half-open connection table. SYN cookies and rate limiting defend against this.
  • Scan detection: SYN scans, FIN scans, NULL scans and the XMAS scan each use a distinct flag pattern. A defender who knows the normal set can spot the odd ones in logs.
  • Firewall behaviour: stateful firewalls track which flags are valid for a connection's current state and drop segments that do not fit, such as an ACK for a connection they never saw open.
  • RST injection: a forged RST can cut a connection. Seeing resets that do not match the traffic pattern is a sign worth investigating.

The right level of detail here is recognition and defence, not attack recipes. Study these patterns so you can read captures and tune detection rules.

Common misunderstandings

  • "Every packet has only one flag." No. ACK rides along with most flags, and the handshake reply carries SYN and ACK together.
  • "PSH means the data is important." PSH is about timing, not priority. It tells TCP to deliver buffered data now rather than wait.
  • "RST means an error occurred." Not always. A RST to a closed port is the normal, correct response.
  • "URG is widely used." It is effectively obsolete and often stripped by middleboxes.
  • "Flags live in the IP header." The IP header has its own, different flags (such as Don't Fragment). TCP flags are in the TCP header.

Next step

Open a packet capture tool, start a single web or SSH connection, and filter for SYN, then RST, then FIN. Matching each flag to what you see on screen fixes the idea far better than re-reading a table. To take networking fundamentals through to certification, look at structured CCNA networking training, where handshakes, flags and captures are practised hands-on.

Related reading

Frequently Asked Questions

The TCP header defines a set of control bits. Six are used in everyday work: SYN, ACK, FIN, RST, PSH and URG. Two more, CWR and ECE, support Explicit Congestion Notification, and one bit in that byte remains reserved. Most packet captures only involve the six main flags.

SYN requests a new connection and synchronises sequence numbers, so it appears mainly at the start. ACK confirms that data or control messages were received and appears on almost every segment after the first SYN. The handshake reply sets both at once as SYN-ACK.

Yes. Flags are independent bits, so several can be set together. SYN-ACK during the handshake, PSH-ACK for interactive data and FIN-ACK when closing are all common. Some combinations, such as SYN with FIN, are contradictory and usually signal scanning or malformed traffic.

FIN closes a connection gracefully: each side finishes sending, then acknowledges the other's FIN. RST aborts immediately with no cleanup, which is the correct response to a packet sent to a closed port or an unexpected connection state.

PSH tells the receiving TCP stack to pass buffered data to the application straight away instead of waiting for the buffer to fill. It controls delivery timing, not importance, and interactive protocols such as SSH set it so each keystroke arrives without delay.

Rarely. The urgent pointer mechanism is effectively obsolete, modern applications avoid it, and some network devices clear the bit. Unexpected URG traffic is more likely to be a scan or an anomaly than a legitimate urgent signal, so treat it with caution.

Use Wireshark display filters such as tcp.flags.syn == 1 && tcp.flags.ack == 0, or tcpdump expressions like tcp[tcpflags] == tcp-syn. Follow a single connection and you will see SYN, SYN-ACK and ACK at the start and FIN or RST at the end.

Flags underpin the handshake, scan detection and firewall logic that CCNA and Security+ test. Knowing which flag combinations are normal lets you spot SYN floods, FIN, NULL and XMAS scans, and forged resets in captures and logs, which is core analyst work.

What's Your Reaction?

Like Like 0
Dislike Dislike 0
Love Love 0
Funny Funny 0
Wow Wow 0
Sad Sad 0
Angry Angry 0
Vaishnavi

Vaishnavi is a skilled tech professional at the Ethical Hacking Training Institute in Pune, responsible for managing and optimizing the technical infrastructure that supports advanced cybersecurity education. With deep expertise in network security, backend operations, and system performance, she ensures that practical labs, online modules, and assessments run smoothly and securely. Her behind-the-scenes contributions play a vital role in delivering a seamless and secure learning experience for aspiring ethical hackers.