redzilla
All tools
Layer 2

Q-in-Q (802.1ad)

Build or decode a frame with 802.1ad double tagging: the provider S-TAG (0x88a8) and the customer C-TAG (0x8100), each with PCP, DEI and VLAN ID in binary, plus the 8-byte overhead.

Mode
S-TAG Provider tag TPID 0x88A8

Usable: 1–4094. Assigned by the operator to separate customers.

C-TAG Customer tag TPID 0x8100

Usable: 1–4094. The original VLAN of the customer's network.

redzilla.cl — qinq
 
S-TCI
C-TCI
Double tag
S-VID · service VLAN
C-VID · customer VLAN
Q-in-Q overhead
8 bytes
2 tags × 4 bytes

Binary breakdown of each TCI (16 bits)

PCP (3 bits) DEI (1 bit) VID (12 bits)

802.1ad double-tagged frame structure

Order after the source MAC, two 4-byte tags are stacked: first the S-TAG (outer) and then the C-TAG (inner), before the EtherType.

S-TAG from the provider, TPID 0x88A8 (802.1ad). Its VID (S-VID) identifies the service or the customer inside the operator's network.

C-TAG from the customer, TPID 0x8100 (802.1Q). Its VID (C-VID) is the original VLAN the customer carries untouched.

TCI PCP = (TCI >> 13) & 0x7 · DEI = (TCI >> 12) & 0x1 · VID = TCI & 0x0FFF.

Overhead 8 bytes total. The trunk MTU must absorb them: with a 1500-byte payload, the double-tagged frame reaches 1526 bytes on the wire (jumbo / baby-giant frames are often used).

Runs locally in your browser · no sign-up · nothing leaves your browser

How it works

The tool works with IEEE 802.1ad (Q-in-Q) double VLAN tagging in two modes: compose builds both tags from the PCP, DEI and VLAN ID of each layer, and decode does the reverse from the hexadecimal TCI (or from the full 32-bit tag with TPID included). The outer tag is the provider S-TAG (TPID 0x88A8) and the inner one is the customer C-TAG (TPID 0x8100, the original 802.1Q tag).

Each TCI is 16 bits laid out as PCP (3 bits) | DEI (1 bit) | VID (12 bits), that is TCI = PCP×8192 + DEI×4096 + VID. The tool shows a color-coded binary breakdown, interprets the PCP per the 802.1p classes (0 Best Effort, 5 Voice, 7 Network Control…), flags the special VIDs (0 priority-tagged, 1 default, 4095 reserved) and reports the total overhead: 8 bytes per frame (2 tags × 4 bytes).

Example: S-VID 100 service with priority 3 over customer VLAN 200

  1. S-TAG: PCP 3, DEI 0, VID 100 → TCI = 3×8192 + 0 + 100 = 0x6064; with the TPID the full tag is 0x88A86064.
  2. C-TAG: PCP 0, DEI 0, VID 200 → TCI = 0x00C8; full tag 0x810000C8.
  3. The frame travels with 8 extra header bytes: with a 1500-byte payload it reaches 1526 bytes on the wire.

Frequently asked questions

What is the difference between the S-TAG and the C-TAG in Q-in-Q?
The C-TAG (TPID 0x8100) is the customer original 802.1Q tag and travels untouched through the operator network. The S-TAG (TPID 0x88A8) is added by the provider on the outside to separate each customer or service on its trunk. When leaving the operator network the S-TAG is removed and the customer gets its VLAN back exactly as sent.
Why use Q-in-Q if I already have 802.1Q VLANs?
For two reasons: to carry the VLANs of many customers over the same metro network without their numbering colliding, and to overcome the 4094-VLAN limit, since the S-VID by C-VID combination yields up to about 16 million identifiers. It is the basis of carrier Ethernet services (E-Line, E-LAN).
What MTU do I need on trunk links for Q-in-Q?
The double tag adds 8 bytes of header: a frame with a 1500-byte payload reaches 1526 bytes on the wire instead of 1518. Trunk switches must accept baby-giant frames or have the MTU raised (for example to 1600 or 9216); otherwise they silently drop full-size frames.
What does a VID of 0 or 4095 mean in a tag?
They are special values in the standard: VID 0 indicates a priority-tagged frame, which carries a PCP priority but belongs to no VLAN, and VID 4095 is reserved and must not be used. The range assignable to real VLANs is 1 to 4094; the tool flags these cases automatically.
Was this tool useful?
Disclaimer We take great care to keep every tool accurate and review it thoroughly; even so, we can't guarantee it is free of errors or take responsibility for how the results are used. We recommend double-checking anything critical.
Found an error? Let us know →