W3C Traceparent Header Parser
Paste a traceparent header to split it into its four fields and check it
against the W3C Trace Context rules — or generate a valid one to test with. Tracestate is
parsed too.
Everything runs locally: what you paste never leaves your browser.
Parse and validate a traceparent header
Valid traceparent (version 00, sampled)
Version · 1 byte
00
Trace ID · 16 bytes
4bf92f3577b34da6a3ce929d0e0e4736
Parent (span) ID · 8 bytes
00f067aa0ba902b7
Trace flags · 1 byte
01
| Bit | Flag | Set | Meaning |
|---|---|---|---|
| 0 | sampled | Yes | the caller may have recorded this trace |
| 1 | random | No | the trace-id’s right 7 bytes are random (Trace Context Level 2) |
2 tracestate members: rojo, congo
Generate a traceparent
curl
curl https://example.com/api \
-H "traceparent: 00-4bf92f3577b34da6a3ce929d0e0e4736-00f067aa0ba902b7-01" \
-H "tracestate: rojo=00f067aa0ba902b7,congo=t61rcWkgMzE"
Raw HTTP
GET /api HTTP/1.1
Host: example.com
traceparent: 00-4bf92f3577b34da6a3ce929d0e0e4736-00f067aa0ba902b7-01
tracestate: rojo=00f067aa0ba902b7,congo=t61rcWkgMzE
JavaScript (OpenTelemetry)
import { context, propagation } from '@opentelemetry/api';
// Writes traceparent (and tracestate) for the active span into `headers`.
const headers = {};
propagation.inject(context.active(), headers);
How the header is read
A traceparent is four fields separated by dashes. The example above is the one used in the
W3C specification: version 00, a 16-byte trace ID shared by every span in the
request, the 8-byte ID of the span that made this call, and a flags byte whose lowest bit
says whether the caller sampled the trace. Version 00 headers are exactly 55 characters.
Validation follows the specification rather than being lenient: IDs must be lowercase hex,
neither ID may be all zeros, and version ff is forbidden. A header from a
future version is still read the way the spec requires — the first four fields are parsed
and anything after them is kept — so a newer header does not break older tooling.
A W3C trace context online decoder and traceparent header generator
Most people arrive needing a W3C trace context online decoder to find out why a trace is broken, or a traceparent header generator to inject a known trace ID into a test request. Both are here, along with a tracestate header parser that checks the vendor list for the mistakes that get it silently dropped: uppercase keys, duplicate keys, a stray equals sign, or more than 32 members.
Where these rules come from
The field lengths, the lowercase-hex rule, the invalid all-zero IDs, the forbidden version and the forward-compatibility behaviour are from the W3C Trace Context Recommendation. The random flag is from Trace Context Level 2. OpenTelemetry uses this header as its default propagation format.