Subnetcalculator

DSCP / QoS Value Converter

Convert between DSCP names, decimal, binary, ToS byte, and IP Precedence. Essential for QoS automation scripts and YANG-modelled network configurations.

Any Format In

Name, decimal, hex, binary, or ToS byte — the tool detects the format automatically

Config Snippets

Generates ready-to-paste Cisco IOS class-map and policy-map config for each value

Full Reference Table

All 22 named DSCP values with traffic types, RFC references, and click-to-convert

Convert a DSCP Value

Enter any format: name (EF, AF41, CS3), decimal (46), hex (0x2E), binary (101110), or ToS byte.

Enter a DSCP value to see conversions

DSCP Reference Table

Name Dec ToS PHB
CS0(Default) 0 0x00 BE
CS1 8 0x20 CS1
AF11 10 0x28 AF1
AF12 12 0x30 AF1
AF13 14 0x38 AF1
CS2 16 0x40 CS2
AF21 18 0x48 AF2
AF22 20 0x50 AF2
AF23 22 0x58 AF2
CS3 24 0x60 CS3
AF31 26 0x68 AF3
AF32 28 0x70 AF3
AF33 30 0x78 AF3
CS4 32 0x80 CS4
AF41 34 0x88 AF4
AF42 36 0x90 AF4
AF43 38 0x98 AF4
CS5 40 0xA0 CS5
VA 44 0xB0 VA
EF 46 0xB8 EF
CS6 48 0xC0 CS6
CS7 56 0xE0 CS7

DSCP, ToS, and QoS in Network Automation

Conversion Formulas

  • ToS byte = DSCP × 4
  • ToS hex = (DSCP × 4).toString(16)
  • IP Precedence = DSCP ÷ 8 (integer)
  • DSCP from ToS = ToS byte ÷ 4
  • Binary (6-bit) = DSCP.toString(2).padStart(6)

DSCP in Automation Tools

  • Cisco IOS XE YANGdscp-value leaf expects decimal or name
  • Ansible (ios_config) — uses DSCP name (ef, af41)
  • NETCONF — DSCP appears as uint8 in QoS YANG models
  • Python (scapy)IP(tos=0xB8) for EF marking
  • Nornir + NAPALM — QoS policy dicts use decimal values

The DSCP Architecture (RFC 2474 / RFC 2597)

Class DSCP Values Typical Use Queue Treatment
EF46VoIP, real-time audioPriority queue (LLQ)
AF4x34, 36, 38Video conferencingBandwidth-guaranteed queue
AF3x26, 28, 30Streaming video / multimediaBandwidth-guaranteed queue
AF2x18, 20, 22Transactional / ERPBandwidth-guaranteed queue
AF1x10, 12, 14Bulk data, backupsBest-effort with WRED
CS6/CS748, 56Routing protocols, OSPF, BGPPriority / control plane
CS00Unclassified / best effortDefault queue

Frequently Asked Questions

What is DSCP and why does it matter for network automation?

DSCP (Differentiated Services Code Point) is a 6-bit field in the IP header (RFC 2474) that marks packets for Quality of Service treatment. In network automation, DSCP values appear in QoS policy definitions, YANG models for QoS configuration, Ansible playbooks for Cisco or Juniper, and telemetry data. Automation scripts often need to convert between the human-readable name (EF, AF41) and the raw decimal or hex value used in device APIs.

What is the relationship between DSCP and ToS?

The ToS (Type of Service) byte in IPv4 is an 8-bit field. DSCP occupies the top 6 bits of this field (bits 7-2). To convert: ToS byte = DSCP decimal × 4. For example, DSCP EF (46) maps to ToS 184 (0xB8). The bottom 2 bits of the ToS byte are the ECN (Explicit Congestion Notification) field.

What is the difference between DSCP and IP Precedence?

IP Precedence is the older 3-bit classification scheme (RFC 791), which used the top 3 bits of the ToS byte with values 0–7. DSCP (RFC 2474) replaced it with a 6-bit field and a more flexible per-hop behavior model. IP Precedence value = DSCP decimal ÷ 8 (integer division). Most modern devices support DSCP; IP Precedence is mainly relevant for legacy devices.

What does Assured Forwarding (AF) mean?

Assured Forwarding (RFC 2597) defines 4 classes (AF1–AF4) with 3 drop precedences each (low, medium, high), giving 12 AF values. The naming convention is AFxy where x=class (1–4) and y=drop precedence (1=low, 2=medium, 3=high). Higher drop precedence means packets are more likely to be dropped during congestion. For example, AF41 (video conferencing, low drop) is preferred over AF43 (same class, high drop).

What is EF (Expedited Forwarding) used for?

EF (DSCP 46, RFC 3246) is the standard DSCP value for VoIP/voice traffic. It guarantees low latency, low jitter, and low packet loss. In Cisco IOS, voice traffic is typically marked EF and placed in a priority queue (LLQ). All other traffic classes must not exceed their configured bandwidth to ensure voice quality.

How do I use DSCP values in Cisco IOS QoS configuration?

In Cisco IOS, use 'match dscp ef' in a class-map to match EF-marked traffic, or 'set dscp ef' in a policy-map to mark traffic. The DSCP name can be used directly (ef, af41, cs3) rather than the decimal value. Example: 'policy-map MARK-VOICE / class VOICE-TRAFFIC / set dscp ef'. For automation, the tool generates the correct Cisco snippet for each DSCP value.

Related Network Automation Tools