X-B3-TraceId

Distributed trace propagation in the Zipkin ecosystem relies on the X-B3-TraceId unofficial request and response header, which carries the trace identifier linking spans across service boundaries.

Usage

The X-B3-TraceId header originates from the Zipkin distributed tracing ecosystem. Services propagate this header alongside companion B3 headers (X-B3-SpanId, X-B3-ParentSpanId, X-B3-Sampled, and X-B3-Flags) to correlate requests across service boundaries. The trace ID remains constant as a request flows through multiple services, linking all recorded spans into a single trace.

The B3 propagation format was introduced by the Zipkin project and adopted by tracing libraries such as Brave (Java), Spring Cloud Sleuth (now end of life, superseded by Micrometer Tracing), and Istio in legacy header mode. Envoy proxy supports B3 headers alongside the W3C format. Many service meshes and API gateways still generate B3 headers for backward compatibility with existing tracing infrastructure.

The trace ID is either 16 or 32 hexadecimal characters. The 16-character (64-bit) format is the original Zipkin format. The 32-character (128-bit) format aligns with the W3C Traceparent trace ID length and was added to support interoperability between B3 and W3C Trace Context. Systems receiving a 16-character trace ID and forwarding to a W3C-compatible service typically left-pad the value with zeros to produce a 32-character ID.

Single b3 header

The B3 specification also defines a single b3 header that carries the entire trace context in one value. The format is {TraceId}-{SpanId}-{SamplingState}-{ParentSpanId}, with the sampling state set to 1 (accept), 0 (deny), or d (debug). Only the trace ID and span ID are required. The b3-propagation specification recommends the single-header form for transports where header keys are constrained, naming JMS and case-sensitive carriers, and gives the single header precedence when both forms arrive. Envoy and Istio support it alongside the multi-header set.

b3: 80f198ee56343ba864fe8b2a57d3eff7-e457b5a2e4d86bd1-1-05e3ac9a4f6e3b90

Values

64-bit trace ID

A 64-bit trace ID is a 16-character lowercase hexadecimal string. This is the original format used by Zipkin and remains common in deployments running older tracing libraries.

128-bit trace ID

A 128-bit trace ID is a 32-character lowercase hexadecimal string. This format matches the trace ID length in W3C Trace Context and is the recommended format for new deployments. The specification treats the identifier as opaque, while Zipkin's own tracers generate the value with a timestamp in the upper 64 bits by convention.

Example

A service instrumented with Zipkin sends the B3 header set. The 32-character (128-bit) trace ID identifies the trace, and the span ID identifies the current operation within the trace.

X-B3-TraceId: 80f198ee56343ba864fe8b2a57d3eff7
X-B3-SpanId: e457b5a2e4d86bd1
X-B3-ParentSpanId: 05e3ac9a4f6e3b90
X-B3-Sampled: 1

A response from a service using the shorter 64-bit trace ID format. This 16-character hex string is common in older Zipkin deployments.

X-B3-TraceId: 7c6cf5bdd6c2846c

A response from a service mesh or API gateway includes the full 128-bit trace ID. The 32-character format enables direct mapping to the trace ID field in Traceparent.

X-B3-TraceId: cf34637d6ddb269916fec5c33ea0dbc9

See also

Last updated: August 18, 2026