ConfigsMay 9, 2026·3 min read

speedtest-cli — Test Network Bandwidth from the Command Line

A Python CLI that measures download, upload, and ping against Ookla Speedtest servers, ideal for scripted network monitoring and CI health checks.

Introduction

speedtest-cli is a command-line interface for testing internet bandwidth using Ookla's Speedtest.net infrastructure. It lets developers and ops teams measure network performance from servers, containers, or CI pipelines without opening a browser.

What speedtest-cli Does

  • Measures download and upload throughput against the nearest Speedtest server
  • Reports latency (ping) to the selected test server
  • Outputs results in plain text, CSV, or JSON for scripted consumption
  • Lets you pick a specific server by ID or list available servers by distance
  • Supports simple and share-image output modes

Architecture Overview

speedtest-cli is a single-file Python script that communicates with the Speedtest.net HTTP API. It fetches a server list ranked by geographic distance, selects the best candidate based on latency, then performs multi-threaded download and upload transfers to calculate throughput. Results are computed locally and printed to stdout.

Self-Hosting & Configuration

  • Install via pip, pipx, or your distro package manager
  • No configuration files needed; all options are passed as CLI flags
  • Use --server to pin a specific Speedtest server ID for consistent benchmarks
  • Integrate into monitoring with --json piped to a time-series database
  • Works on Linux, macOS, Windows, and inside Docker containers

Key Features

  • Zero-config instant bandwidth test from any terminal
  • JSON and CSV output for integration with dashboards and alerting
  • Server selection by ID, country, or automatic nearest-server detection
  • Lightweight single-file script with no compiled dependencies
  • Widely used as a baseline network diagnostic in DevOps runbooks

Comparison with Similar Tools

  • Ookla Speedtest CLI — official binary from Ookla; speedtest-cli is the community Python alternative
  • fast-cli — tests against Netflix Fast.com; speedtest-cli uses the Ookla network
  • iperf3 — measures raw TCP/UDP between two endpoints you control; speedtest-cli tests internet bandwidth
  • LibreSpeed — self-hosted speed test; speedtest-cli relies on public Ookla servers
  • mtr — focuses on route-level latency and packet loss; speedtest-cli measures throughput

FAQ

Q: Is speedtest-cli the same as the official Ookla Speedtest CLI? A: No. speedtest-cli is a community open-source Python project. Ookla later released their own closed-source binary with the same name concept.

Q: Can I run it in a cron job for continuous monitoring? A: Yes. Use --json and pipe results into InfluxDB, Prometheus Pushgateway, or a log file for trend analysis.

Q: How accurate are the results compared to the browser test? A: Results are generally comparable. Differences may arise from thread count, server selection, and network conditions during the test window.

Q: Does it support IPv6? A: The tool defaults to the system's preferred IP version. Some Speedtest servers support IPv6 depending on their configuration.

Sources

Discussion

Sign in to join the discussion.
No comments yet. Be the first to share your thoughts.

Related Assets