Free tech learning for everyone, from basics to pro

Transport Network DesignNetworking SecurityIntermediate

IP Precedence and DSCP values: CS, AF and EF classes and how to decode them

In short: DSCP is a 6-bit field in the IP header that tells every hop which class a packet belongs to. Class selector values match the old IP Precedence, assured forwarding (AFxy) values combine a class with a drop priority, and EF (46) is for voice. Knowing the formulas lets you decode any value you see in a capture.

One byte, two meanings

The second byte of the IPv4 header, and the Traffic Class byte of IPv6, carries the QoS marking. Its meaning has changed over time, which is why you still see both names in configuration and captures.

The ToS / Traffic Class byteOriginal (RFC 791)IP Precedence: 3 bits, values 0-7, plus old ToS flagsDiffServ (RFC 2474)DSCP: 6 bits, values 0-63ECN (RFC 3168)Last 2 bits: congestion notificationEthernet 802.1Q tagCoS / PCP: 3 bits, values 0-7
Figure 1. The same byte in the IPv4 header (and the Traffic Class byte in IPv6) was first read as IP Precedence, then redefined as a 6-bit DSCP plus 2 ECN bits. Layer 2 has its own 3-bit CoS field in the VLAN tag.

IP Precedence used the top three bits, giving eight values. 0 was routine traffic, 5 was "critical" (used for voice), and 6 and 7 were reserved for network control traffic such as routing protocols. Eight levels proved too coarse, so RFC 2474 redefined the top six bits as the Differentiated Services Code Point (DSCP), with 64 possible values. The two remaining bits became Explicit Congestion Notification (ECN), which lets routers signal congestion without dropping packets.

The three families of DSCP values

FamilyValuesMeaning
Default (DF / CS0)0Best effort
Class selector (CS1-CS7)8, 16, 24 ... 56Backwards compatible with IP Precedence: CSx = precedence x
Assured forwarding (AFxy)AF11 to AF43Four classes (x = 1-4), each with three drop priorities (y = 1-3)
Expedited forwarding (EF)46Low delay, low loss, low jitter: voice

Two formulas cover almost everything:

  • Class selector: CSx = 8 x x. So CS3 = 24 and CS6 = 48.
  • Assured forwarding: AFxy = 8x + 2y. So AF41 = 34, AF31 = 26 and AF13 = 14.

Within an AF class, a higher y means "drop me first". If a provider polices video and finds it over its rate, it can re-mark AF41 to AF42 rather than dropping it; later, if a queue fills, AF42 packets go before AF41.

Converting between decimal, binary and ToS

Capture tools and some devices show the whole byte instead of the DSCP. Because DSCP sits in the top six bits, the ToS byte value is the DSCP multiplied by four (shifted left two bits):

NameDSCP decimalDSCP binaryToS bytePrecedence
EF46101110184 (0xB8)5
AF4134100010136 (0x88)4
CS32401100096 (0x60)3
AF211801001072 (0x48)2
CS1800100032 (0x20)1

Notice that the first three bits of a DSCP value equal the old precedence. A device that only understands precedence still treats EF traffic as precedence 5.

Layer 2 marking and common choices

Switches forwarding frames inside a VLAN may not look at the IP header, so the 802.1Q tag has its own 3-bit Class of Service (CoS) field, also called Priority Code Point (PCP). CoS is lost when the tag is removed, so DSCP is the marking that survives end to end. Switches map between them, for example CoS 5 to EF.

RFC 4594 suggests a common set of classes. Many enterprises use a simplified version:

  • EF: voice media.
  • AF41: interactive video such as video calls.
  • CS3: call signalling (SIP).
  • AF21: business applications that users wait on.
  • CS6: routing protocols and network control.
  • AF11 or CS1: bulk transfers and scavenger traffic. RFC 8622 also defines a "lower effort" value, DSCP 1, for traffic that should only use spare capacity.

Real-world example: an engineer at a university reviewed a packet capture from a lecture hall where video conferencing was choppy. The capture tool showed "DSField 0x88". Dividing 136 by four gave DSCP 34, which is AF41, so the conferencing client was marking correctly. The next capture, taken on the far side of the campus firewall, showed 0x00: the firewall was resetting markings. Allowing the firewall to preserve DSCP fixed the problem.

Practice

What is the decimal DSCP value of AF32?
8 x 3 + 2 x 2 = 28.
A capture shows a ToS byte of 0xB8 (184). Which DSCP value is it?
184 / 4 = 46, which is EF.
Between AF21 and AF23, which is dropped first during congestion?
AF23, because it has the higher drop priority (y = 3).

Key takeaways

  • DSCP is the top 6 bits of the IPv4 ToS byte or IPv6 Traffic Class byte; the last 2 bits are ECN.
  • Class selectors CSx = 8x and match the old IP Precedence values.
  • AFxy = 8x + 2y; a higher y means a higher drop priority within the class.
  • EF (46) is for voice; AF41 for interactive video; CS3 for call signalling.
  • CoS is a 3-bit Layer 2 mark in the 802.1Q tag and disappears when the tag is removed.
Tracks your learning on this device only. See your progress on the learning paths.

About the author

Mohamed Fayas

Founder of FM TecHub. CCNA certified, with a BTEC HND in Network Engineering, and BEng (Hons) in Computer Networking and Cloud Security. He writes practical, plain-English guides on networking, security and cloud.

More about the author

Original content written by Mohamed Fayas for FM TecHub. © 2026 FM TecHub. You're welcome to share a link to this page; please don't copy the text elsewhere without permission.

Stay up to date by email

New notes, tools and security news from FM TecHub, explained simply. Free.

We only use your email to send these updates. See our privacy policy.