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.
DSCP Decimal
DSCP Binary (6-bit)
ToS Byte (decimal)
ToS Byte (hex)
ToS Binary (8-bit)
IP Precedence
Traffic Type
Cisco IOS config snippet
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 YANG —
dscp-valueleaf 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 |
|---|---|---|---|
| EF | 46 | VoIP, real-time audio | Priority queue (LLQ) |
| AF4x | 34, 36, 38 | Video conferencing | Bandwidth-guaranteed queue |
| AF3x | 26, 28, 30 | Streaming video / multimedia | Bandwidth-guaranteed queue |
| AF2x | 18, 20, 22 | Transactional / ERP | Bandwidth-guaranteed queue |
| AF1x | 10, 12, 14 | Bulk data, backups | Best-effort with WRED |
| CS6/CS7 | 48, 56 | Routing protocols, OSPF, BGP | Priority / control plane |
| CS0 | 0 | Unclassified / best effort | Default 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
YANG Module Checker
Validate YANG syntax and explore module node trees for NETCONF/RESTCONF automation.
Jinja2 Template Tester
Render Jinja2 network config templates with test data — no Python required.
Route Summarization
Find the optimal set of summary routes from a list of prefixes for BGP filters.
Routing Simulator
Simulate routing table lookups and understand longest-prefix matching.