A runtime for writing reliable asynchronous applications with Rust. Provides I/O, networking, scheduling, timers, ...
Find a file
Repository files (latest commit first)
Filename Latest commit message Latest commit date
Balazs Horvath 1deb35f08b
Some checks failed
CI / clippy (push) Has been cancelled
Loom / loom time driver (push) Has been cancelled
Loom / loom current-thread scheduler (push) Has been cancelled
Security Audit / cargo-deny (push) Has been cancelled
CI / minrust (push) Has been cancelled
CI / fmt (push) Has been cancelled
CI / docs (push) Has been cancelled
CI / docs-1 (push) Has been cancelled
CI / Check README (push) Has been cancelled
CI / test tokio for wasm32-wasip2 (push) Has been cancelled
Loom / loom tokio::runtime::spawn_blocking (push) Has been cancelled
CI / get-latest-kernel-version (push) Has been cancelled
Loom / loom tokio::sync (push) Has been cancelled
Loom / loom multi-thread scheduler (push) Has been cancelled
Loom / loom multi-thread scheduler-1 (push) Has been cancelled
Loom / loom multi-thread scheduler-2 (push) Has been cancelled
Loom / loom multi-thread scheduler-3 (push) Has been cancelled
Loom / loom tokio-util (push) Has been cancelled
Pull Request Security Audit / cargo-deny (push) Has been cancelled
Stress Test / Stress Test (push) Has been cancelled
CI / cross-test-with-parking_lot (io-uring,taskdump, ubuntu-24.04-arm, aarch64-unknown-linux-gnu) (push) Has been cancelled
CI / cross-test-with-parking_lot (taskdump, ubuntu-latest, i686-unknown-linux-gnu) (push) Has been cancelled
CI / cross-test-with-parking_lot (ubuntu-24.04-arm, armv7-unknown-linux-gnueabihf) (push) Has been cancelled
CI / Test hyper-2 (push) Has been cancelled
CI / build tokio for redox-os (push) Has been cancelled
CI / basic checks (push) Has been cancelled
CI / test tokio full (push) Has been cancelled
CI / test tokio full-1 (push) Has been cancelled
CI / test tokio full-2 (push) Has been cancelled
CI / test all crates in the workspace with all features (push) Has been cancelled
CI / test all crates in the workspace with all features-1 (push) Has been cancelled
CI / test all crates in the workspace with all features-2 (push) Has been cancelled
CI / test all crates in the workspace with all features and panic=abort (push) Has been cancelled
CI / test all crates in the workspace with all features and panic=abort-1 (push) Has been cancelled
CI / test all crates in the workspace with all features and panic=abort-2 (push) Has been cancelled
CI / Run integration tests for each feature (push) Has been cancelled
CI / Run integration tests for each feature-1 (push) Has been cancelled
CI / Run integration tests for each feature-2 (push) Has been cancelled
CI / compile tests with parking lot send guards (push) Has been cancelled
CI / valgrind (push) Has been cancelled
CI / test tokio full --unstable (push) Has been cancelled
CI / test tokio full --unstable-1 (push) Has been cancelled
CI / test tokio full --unstable-2 (push) Has been cancelled
CI / test tokio full --unstable-3 (push) Has been cancelled
CI / test tokio full --unstable --taskdump (push) Has been cancelled
CI / check tokio full --internal-mt-counters (push) Has been cancelled
CI / miri-lib (push) Has been cancelled
CI / miri-test (push) Has been cancelled
CI / miri-doc (push) Has been cancelled
CI / asan (push) Has been cancelled
CI / semver (push) Has been cancelled
CI / cross-check (push) Has been cancelled
CI / cross-check-1 (push) Has been cancelled
CI / cross-check-2 (push) Has been cancelled
CI / cross-check-tier3 (push) Has been cancelled
CI / cross-test-with-parking_lot (ubuntu-latest, armv5te-unknown-linux-gnueabi) (push) Has been cancelled
CI / cross-test-with-parking_lot (windows-11-arm, aarch64-pc-windows-msvc) (push) Has been cancelled
CI / cross-test-without-parking_lot (io-uring,taskdump, ubuntu-24.04-arm, aarch64-unknown-linux-gnu) (push) Has been cancelled
CI / cross-test-without-parking_lot (taskdump, ubuntu-latest, i686-unknown-linux-gnu) (push) Has been cancelled
CI / cross-test-without-parking_lot (ubuntu-24.04-arm, armv7-unknown-linux-gnueabihf) (push) Has been cancelled
CI / cross-test-without-parking_lot (ubuntu-latest, armv5te-unknown-linux-gnueabi) (push) Has been cancelled
CI / cross-test-without-parking_lot (windows-11-arm, aarch64-pc-windows-msvc) (push) Has been cancelled
CI / Test tokio --all-features on i686-unknown-linux-gnu without AtomicU64 (push) Has been cancelled
CI / Check tokio --feature-powerset --depth 2 on i686-unknown-linux-gnu without AtomicU64 (push) Has been cancelled
CI / features exclude --unstable io-uring,taskdump (push) Has been cancelled
CI / features exclude (push) Has been cancelled
CI / features exclude --unstable (push) Has been cancelled
CI / minimal-versions (push) Has been cancelled
CI / build loom tests (push) Has been cancelled
CI / Test hyper (push) Has been cancelled
CI / Test hyper-1 (push) Has been cancelled
CI / Test Quinn (push) Has been cancelled
CI / Test Quinn-1 (push) Has been cancelled
CI / Test Quinn-2 (push) Has been cancelled
CI / build tokio for x86_64-fortanix-unknown-sgx (push) Has been cancelled
CI / test tokio for wasm32-unknown-unknown (macros sync rt) (push) Has been cancelled
CI / test tokio for wasm32-unknown-unknown (macros sync time rt) (push) Has been cancelled
CI / test tokio for wasm32-unknown-unknown (macros sync) (push) Has been cancelled
CI / wasm32-wasip1 (push) Has been cancelled
CI / wasm32-wasip1-threads (push) Has been cancelled
CI / check-external-types (windows-latest) (push) Has been cancelled
CI / check-external-types (ubuntu-latest) (push) Has been cancelled
CI / check-fuzzing (push) Has been cancelled
CI / check-spelling (push) Has been cancelled
CI / FreeBSD x86_64 (push) Has been cancelled
CI / FreeBSD docs (push) Has been cancelled
CI / FreeBSD i686 (push) Has been cancelled
Use sibling tokio path dependencies
2026-05-22 09:59:33 +02:00
.github ci: small improvements for freeBSD jobs (#8102) 2026-05-02 17:44:40 +02:00
benches bench: use is_multiple_of instead of manual modulo check (#7984) 2026-03-22 14:00:12 +01:00
docs/contributing docs: improve contributing docs on how to specify crates dependency versions (#8009) 2026-04-04 09:03:49 +02:00
examples examples: add graceful shutdown example (#7962) 2026-03-30 11:05:53 +02:00
stress-test examples: update rand crate to 0.9.1 (#7371) 2025-05-28 11:32:24 +00:00
target-specs ci: update nightly version to 2025-10-12 (#7670) 2025-10-14 12:56:46 +02:00
tests-build ci: update trybuild to expect output from rustc 1.95.0 (#8058) 2026-04-16 20:32:53 +00:00
tests-integration macros: add "local" runtime flavor (#7375) 2025-07-28 13:59:00 +02:00
tokio Merge 'tokio-1.52.2' into 'master' (#8117) 2026-05-04 19:53:32 +02:00
tokio-macros chore: remove path deps for tokio-macros 2.7.0 (#8007) 2026-04-03 11:10:55 +02:00
tokio-stream Use sibling tokio path dependencies 2026-05-22 09:59:33 +02:00
tokio-test Use sibling tokio path dependencies 2026-05-22 09:59:33 +02:00
tokio-util Use sibling tokio path dependencies 2026-05-22 09:59:33 +02:00
.gitignore macros: improve error message for return type mismatch in #[tokio::main] (#7856) 2026-01-25 01:09:05 +09:00
Cargo.toml ci: patch workspace members to disambiguate --package (#7967) 2026-03-18 07:27:46 +01:00
CODE_OF_CONDUCT.md chore: improve discoverability of CoC (#2180) 2020-01-29 10:56:11 -08:00
CONTRIBUTING.md docs: break up CONTRIBUTING.md into several parts (#7762) 2025-12-07 19:10:54 +08:00
Cross.toml chore: move conditional AtomicU64 impl to new file (#5256) 2022-12-02 11:47:11 -08:00
deny.toml ci: remove cargo-deny Unicode-DFS-2016 license exception config (#7619) 2025-10-10 16:55:48 +02:00
LICENSE license: fix formatting and remove year in licenses (#6451) 2024-05-26 09:29:27 +00:00
netlify.toml ci: update nightly version to 2025-10-12 (#7670) 2025-10-14 12:56:46 +02:00
README.md chore: prepare Tokio v1.52.2 (#8115) 2026-05-04 14:39:25 +02:00
SECURITY.md chore: fix spelling mistakes (#4858) 2022-07-25 07:26:01 +00:00
spellcheck.dic net: implement UCred::pid on FreeBSD (#8086) 2026-05-03 10:28:31 +02:00
spellcheck.toml ci: add spellchecking (#6297) 2024-01-29 10:53:43 +01:00

TokioConf 2026 program and tickets are now available!


Tokio

A runtime for writing reliable, asynchronous, and slim applications with the Rust programming language. It is:

  • Fast: Tokio's zero-cost abstractions give you bare-metal performance.

  • Reliable: Tokio leverages Rust's ownership, type system, and concurrency model to reduce bugs and ensure thread safety.

  • Scalable: Tokio has a minimal footprint, and handles backpressure and cancellation naturally.

Crates.io MIT licensed Build Status Discord chat

Website | Guides | API Docs | Chat

Overview

Tokio is an event-driven, non-blocking I/O platform for writing asynchronous applications with the Rust programming language. At a high level, it provides a few major components:

  • A multithreaded, work-stealing based task scheduler.
  • A reactor backed by the operating system's event queue (epoll, kqueue, IOCP, etc.).
  • Asynchronous TCP and UDP sockets.

These components provide the runtime components necessary for building an asynchronous application.

Example

A basic TCP echo server with Tokio.

Make sure you enable the full features of the tokio crate on Cargo.toml:

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

Then, on your main.rs:

use tokio::net::TcpListener;
use tokio::io::{AsyncReadExt, AsyncWriteExt};

#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
    let listener = TcpListener::bind("127.0.0.1:8080").await?;

    loop {
        let (mut socket, _) = listener.accept().await?;

        tokio::spawn(async move {
            let mut buf = [0; 1024];

            // In a loop, read data from the socket and write the data back.
            loop {
                let n = match socket.read(&mut buf).await {
                    // socket closed
                    Ok(0) => return,
                    Ok(n) => n,
                    Err(e) => {
                        eprintln!("failed to read from socket; err = {:?}", e);
                        return;
                    }
                };

                // Write the data back
                if let Err(e) = socket.write_all(&buf[0..n]).await {
                    eprintln!("failed to write to socket; err = {:?}", e);
                    return;
                }
            }
        });
    }
}

More examples can be found here. For a larger "real world" example, see the mini-redis repository.

To see a list of the available feature flags that can be enabled, check our docs.

Getting Help

First, see if the answer to your question can be found in the Guides or the API documentation. If the answer is not there, there is an active community in the Tokio Discord server. We would be happy to try to answer your question. You can also ask your question on the discussions page.

Contributing

🎈 Thanks for your help improving the project! We are so happy to have you! We have a contributing guide to help you get involved in the Tokio project.

In addition to the crates in this repository, the Tokio project also maintains several other libraries, including:

  • axum: A web application framework that focuses on ergonomics and modularity.

  • hyper: A fast and correct HTTP/1.1 and HTTP/2 implementation for Rust.

  • tonic: A gRPC over HTTP/2 implementation focused on high performance, interoperability, and flexibility.

  • warp: A super-easy, composable, web server framework for warp speeds.

  • tower: A library of modular and reusable components for building robust networking clients and servers.

  • tracing (formerly tokio-trace): A framework for application-level tracing and async-aware diagnostics.

  • mio: A low-level, cross-platform abstraction over OS I/O APIs that powers tokio.

  • bytes: Utilities for working with bytes, including efficient byte buffers.

  • loom: A testing tool for concurrent Rust code.

Changelog

The Tokio repository contains multiple crates. Each crate has its own changelog.

Supported Rust Versions

Tokio will keep a rolling MSRV (minimum supported rust version) policy of at least 6 months. When increasing the MSRV, the new Rust version must have been released at least six months ago. The current MSRV is 1.71.

Note that the MSRV is not increased automatically, and only as part of a minor release. The MSRV history for past minor releases can be found below:

  • 1.48 to now - Rust 1.71
  • 1.39 to 1.47 - Rust 1.70
  • 1.30 to 1.38 - Rust 1.63
  • 1.27 to 1.29 - Rust 1.56
  • 1.17 to 1.26 - Rust 1.49
  • 1.15 to 1.16 - Rust 1.46
  • 1.0 to 1.14 - Rust 1.45

Note that although we try to avoid the situation where a dependency transitively increases the MSRV of Tokio, we do not guarantee that this does not happen. However, every minor release will have some set of versions of dependencies that works with the MSRV of that minor release.

Release schedule

Tokio doesn't follow a fixed release schedule, but we typically make one minor release each month. We make patch releases for bugfixes as necessary.

Bug patching policy

For the purposes of making patch releases with bugfixes, we have designated certain minor releases as LTS (long term support) releases. Whenever a bug warrants a patch release with a fix for the bug, it will be backported and released as a new patch release for each LTS minor version. Our current LTS releases are:

  • 1.47.x - LTS release until September 2026. (MSRV 1.70)
  • 1.51.x - LTS release until March 2027. (MSRV 1.71)

Each LTS release will continue to receive backported fixes for at least a year. If you wish to use a fixed minor release in your project, we recommend that you use an LTS release.

To use a fixed minor version, you can specify the version with a tilde. For example, to specify that you wish to use the newest 1.47.x patch release, you can use the following dependency specification:

tokio = { version = "~1.47", features = [...] }

Previous LTS releases

  • 1.8.x - LTS release until February 2022.
  • 1.14.x - LTS release until June 2022.
  • 1.18.x - LTS release until June 2023.
  • 1.20.x - LTS release until September 2023.
  • 1.25.x - LTS release until March 2024.
  • 1.32.x - LTS release until September 2024.
  • 1.36.x - LTS release until March 2025.
  • 1.38.x - LTS release until July 2025.
  • 1.43.x - LTS release until March 2026.

License

This project is licensed under the MIT license.

Contribution

Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in Tokio by you shall be licensed as MIT, without any additional terms or conditions.