---
title: Trace and Span ID Formats
description: >-
  Guide on valid trace and span ID formats supported by Datadog tracing
  libraries and how they correlate with logs.
breadcrumbs: Docs > APM > Tracing Guides > Trace and Span ID Formats
---

# Trace and Span ID Formats

This page details Datadog tracing library support for trace and span ID (A span ID is a numerical identifier generated by the tracing library for a span. Together with trace IDs, they are used to correlate traces and logs in Datadog.)s.

- **Generated IDs**: By default, all tracing libraries generate 128-bit trace IDs and 64-bit span IDs.
- **Accepted IDs**: Datadog accepts 128-bit or 64-bit trace IDs, and 64-bit span IDs.

## 128-bit trace IDs

128-bit trace IDs are generated and accepted by default in the latest versions of Datadog tracing libraries:

- [Node.js](https://github.com/DataDog/dd-trace-js/releases)
- [Java](https://github.com/DataDog/dd-trace-java/releases)
- [Go](https://github.com/DataDog/dd-trace-go/releases)
- [Python](https://github.com/DataDog/dd-trace-py/releases)
- [Ruby](https://github.com/DataDog/dd-trace-rb/releases)
- [.NET](https://github.com/DataDog/dd-trace-dotnet/releases)
- [PHP](https://github.com/DataDog/dd-trace-php/releases)
- [C++](https://github.com/DataDog/dd-trace-cpp/releases)

## 64-bit trace and span IDs

### Trace IDs{% #trace-ids %}

Trace IDs are generated as 128-bit by default, and they are accepted as either 128-bit or 64-bit integers. To generate 64-bit trace IDs, set the environment variable `DD_TRACE_128_BIT_TRACEID_GENERATION_ENABLED` to `false`.

### Span IDs{% #span-ids %}

Span IDs are limited to 64-bits in Datadog.

| Language | Generated IDs          | Valid, Accepted 64-bit int IDs |
| -------- | ---------------------- | ------------------------------ |
| Node.js  | Unsigned [0, $2^63$]   | Signed or unsigned             |
| Java     | Unsigned [1, $2^63-1$] | Unsigned                       |
| Go       | Unsigned [0, $2^63-1$] | Signed or unsigned             |
| Python   | Unsigned [0, $2^64-1$] | Unsigned                       |
| Ruby     | Unsigned [1, $2^62-1$] | Unsigned                       |
| .NET     | Unsigned [0, $2^63-1$] | Unsigned                       |
| PHP      | Unsigned [1, $2^64-1$] | Unsigned                       |
| C++      | Unsigned [0, $2^63-1$] | Unsigned                       |

## Further reading{% #further-reading %}

- [Correlating logs and traces](https://docs.datadoghq.com/tracing/other_telemetry/connect_logs_and_traces/)
