Skip to main content
Tokio is distributed as a Rust crate and can be easily added to your project using Cargo. The library uses feature flags to allow you to enable only the functionality you need.

Basic installation

Add Tokio to your Cargo.toml dependencies:
Cargo.toml
[dependencies]
tokio = { version = "1.50.0", features = ["full"] }
The full feature flag enables all of Tokio’s public APIs, which is the recommended starting point for applications.
The latest stable version of Tokio is 1.50.0. Check crates.io for the most recent version.

Feature flags

Tokio uses feature flags to reduce compiled code size. You can enable only the features your application needs.

Common feature combinations

[dependencies]
tokio = { version = "1.50.0", features = ["full"] }

Available features

Here are the main feature flags available in Tokio:
  • rt: Enables tokio::spawn and the current-thread scheduler
  • rt-multi-thread: Enables the multi-threaded, work-stealing scheduler
  • macros: Enables #[tokio::main] and #[tokio::test] macros
  • io-util: Enables IO-based extension traits
  • io-std: Enables Stdout, Stdin, and Stderr types
  • net: Enables tokio::net types like TcpStream and UdpSocket
  • fs: Enables tokio::fs for asynchronous filesystem operations
  • sync: Enables all tokio::sync types (channels, mutexes, etc.)
  • time: Enables tokio::time types for timeouts and intervals
  • process: Enables tokio::process for spawning child processes
  • signal: Enables tokio::signal for OS signal handling
  • full: Enables all stable features (recommended for applications)
  • test-util: Enables testing utilities for the Tokio runtime
  • parking_lot: Uses the parking_lot crate’s synchronization primitives internally
As a library author, enable only the features you need to provide the lightest weight crate for your users. Application developers can use the full feature for convenience.

Minimum supported Rust version

Tokio requires Rust 1.71 or later. The library follows a rolling MSRV policy where the minimum supported Rust version must have been released at least 6 months ago.
Cargo.toml
[package]
name = "my-app"
version = "0.1.0"
edition = "2021"
rust-version = "1.71"

[dependencies]
tokio = { version = "1.50.0", features = ["full"] }
The MSRV may increase as part of a minor release. Check the CHANGELOG when upgrading.

LTS releases

Tokio offers LTS (long term support) releases that receive backported bugfixes for at least one year:
  • 1.43.x - LTS until March 2026 (MSRV 1.70)
  • 1.47.x - LTS until September 2026 (MSRV 1.70)
To pin your project to an LTS release, use a tilde version requirement:
Cargo.toml
[dependencies]
tokio = { version = "~1.43", features = ["full"] }
This ensures you receive patch updates within the 1.43.x series without automatically upgrading to newer minor versions.

Unstable features

Some features require the tokio_unstable configuration flag. These features may break in 1.x releases. To enable unstable features, add this to .cargo/config.toml:
.cargo/config.toml
[build]
rustflags = ["--cfg", "tokio_unstable"]
The [build] section goes in .cargo/config.toml, not in Cargo.toml.
Alternatively, use an environment variable:
export RUSTFLAGS="--cfg tokio_unstable"
cargo build
Unstable features include:
  • tracing: Enables tracing events
  • io-uring: Enables io-uring support (Linux only)
  • taskdump: Enables taskdump functionality (Linux only)

Verification

Verify your installation by creating a simple hello world program:
1

Create a new Rust project

cargo new tokio-hello
cd tokio-hello
2

Add Tokio to Cargo.toml

Cargo.toml
[dependencies]
tokio = { version = "1.50.0", features = ["full"] }
3

Write an async program

src/main.rs
#[tokio::main]
async fn main() {
    println!("Hello from Tokio!");
}
4

Run the program

cargo run
You should see:
Hello from Tokio!

Next steps

Quickstart

Build your first async application with Tokio

API documentation

Explore the complete API reference

Build docs developers (and LLMs) love