Skip to main content

speedtest-cli

Command line interface for testing internet bandwidth using speedtest.net.

Repository: https://github.com/DownloaderZone/Speedtest-Cli

Official Ookla Speedtest CLI

Always use official: For maximum throughput (especially gigabit/multi-gigabit lines), official Ookla latency measurement, and server compatibility, the official Ookla Speedtest CLI binary is recommended.

To remove legacy speedtest-cli and install the official Ookla Speedtest CLI:

sudo apt-get remove speedtest-cli
sudo apt-get install curl
curl -s https://packagecloud.io/install/repositories/ookla/speedtest-cli/script.deb.sh | sudo bash
sudo apt-get install speedtest

This Python CLI automatically detects and delegates to the official Ookla binary when installed on your system. You can force official delegation with --official or force the pure Python implementation with --pure-python.

Supported Python Versions

speedtest-cli requires Python 3.8+ (tested through Python 3.8, 3.9, 3.10, 3.11, 3.12, 3.13, and 3.14+).

Legacy Python 2.x and ancient Python 3 (< 3.8) support has been completely removed to ensure high reliability, modern TLS security, and standard library compliance.

Installation

Pip / PyPI

pip install dz-speedtest-cli

or directly from GitHub:

pip install git+https://github.com/DownloaderZone/Speedtest-Cli.git

Github

git clone https://github.com/DownloaderZone/Speedtest-Cli.git
cd Speedtest-Cli
python setup.py install

Direct Download

curl -Lo speedtest-cli https://raw.githubusercontent.com/DownloaderZone/Speedtest-Cli/master/speedtest.py
chmod +x speedtest-cli

Usage

$ speedtest-cli -h
usage: speedtest-cli [-h] [--no-download] [--no-upload] [--single] [--bytes]
                     [-u {bps,kbps,Mbps,Gbps,B/s,kB/s,MB/s,GB/s,auto}]
                     [-f {human-readable,json,json-pretty,csv,tsv}]
                     [-p PROGRESS] [--no-progress] [--share] [--simple] [--csv]
                     [--csv-delimiter CSV_DELIMITER] [--csv-header] [--json]
                     [-L] [-s SERVER] [-o HOST] [--exclude EXCLUDE]
                     [--mini MINI] [-i SOURCE] [-I INTERFACE]
                     [--timeout TIMEOUT] [--secure] [--no-pre-allocate] [-V]
                     [-v] [--selection-details] [--accept-license]
                     [--accept-gdpr] [--official] [--pure-python]

Command line interface for testing internet bandwidth using speedtest.net.
--------------------------------------------------------------------------
https://github.com/DownloaderZone/Speedtest-Cli

options:
  -h, --help            show this help message and exit
  --no-download         Do not perform download test
  --no-upload           Do not perform upload test
  --single              Only use a single connection instead of multiple. This
                        simulates a typical file transfer.
  --bytes               Display values in bytes instead of bits. Does not
                        affect the image generated by --share, nor output from
                        --json or --csv
  -u, --unit {bps,kbps,Mbps,Gbps,B/s,kB/s,MB/s,GB/s,auto}
                        Output unit for speed (bps, kbps, Mbps, Gbps, B/s,
                        kB/s, MB/s, GB/s, auto)
  -f, --format {human-readable,json,json-pretty,csv,tsv}
                        Output format (human-readable, json, json-pretty, csv,
                        tsv)
  -p, --progress PROGRESS
                        Display progress meter (yes or no)
  --no-progress         Disable progress meter
  --share               Generate and provide a URL to the speedtest.net share
                        results image, not displayed with --csv
  --simple              Suppress verbose output, only show basic information
  --csv                 Suppress verbose output, only show basic information
                        in CSV format. Speeds listed in bit/s and not affected
                        by --bytes
  --csv-delimiter CSV_DELIMITER
                        Single character delimiter to use in CSV output.
                        Default ","
  --csv-header          Print CSV headers
  --json                Suppress verbose output, only show basic information
                        in JSON format. Speeds listed in bit/s and not
                        affected by --bytes
  -L, --list, --servers
                        Display a list of speedtest.net servers sorted by
                        distance
  -s, --server, --server-id SERVER
                        Specify a server ID to test against. Can be supplied
                        multiple times
  -o, --host HOST       Specify a server host (e.g. host:port) to test against
  --exclude EXCLUDE     Exclude a server from selection. Can be supplied
                        multiple times
  --mini MINI           URL of the Speedtest Mini server
  -i, --source, --ip SOURCE
                        Source IP address to bind to
  -I, --interface INTERFACE
                        Source network interface to bind to
  --timeout TIMEOUT     HTTP timeout in seconds. Default 10
  --secure              Use HTTPS instead of HTTP when communicating with
                        speedtest.net operated servers
  --no-pre-allocate     Do not pre allocate upload data. Pre allocation is
                        enabled by default to improve upload performance. To
                        support systems with insufficient memory, use this
                        option to avoid a MemoryError
  -V, --version         Show the version number and exit
  -v, --verbose         Logging verbosity (can specify multiple times: -v,
                        -vv)
  --selection-details   Show details of the server selection
  --accept-license      Acknowledge license (for compatibility with Ookla CLI)
  --accept-gdpr         Acknowledge GDPR notice (for compatibility with Ookla
                        CLI)
  --official            Force delegation to official Ookla speedtest CLI
                        binary
  --pure-python         Force using the pure-Python speedtest engine

Inconsistency

Server selection

The Python engine discovers current nearby servers and selects the nearest reachable server by geographic distance. Servers at the same distance are compared using the median of three HTTP round-trip measurements. Unreachable servers are skipped. Discovery falls back to the legacy server catalog if the current API is unavailable.

To inspect the selection:

python speedtest.py --pure-python --selection-details

If your ISP’s IP geolocation points to the wrong city, supply your actual latitude and longitude (the coordinates below are an example):

python speedtest.py --location 30.9010 75.8573 --selection-details

To compare nearby servers by latency instead of choosing the nearest:

python speedtest.py --selection latency --selection-details

--location and --selection automatically use the Python engine. Without these flags, an installed official Ookla binary still uses its own selection. Distances depend on client and server coordinates; IP geolocation is an estimate.

Measurement differences

It is not a goal of this application to be a reliable latency reporting tool.

Latency is measured as a full HTTP round trip, including connection setup and reading the latency response. It is not an ICMP ping measurement.

There is the potential for pure Python HTTP-based tests to report results lower than official socket-based tests on high bandwidth connections (gigabit+). For official line rates, install the official Ookla CLI via the instructions above.

Metadata

Release files for dz-speedtest-cli 2.2.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for dz-speedtest-cli 2.2.1
File Size Uploaded
dz_speedtest_cli-2.2.1.tar.gz 29.0 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for dz-speedtest-cli 2.2.1
File Interpreter ABI Platform
dz_speedtest_cli-2.2.1-py3-none-any.whl Python 3 none any Details

Total release size: 54.6 kB

Release files / dz_speedtest_cli-2.2.1.tar.gz

Download URL dz_speedtest_cli-2.2.1.tar.gz
Size 29.0 kB
Tags Source
SHA-256 checksum
How to use checksums
bf7af03b34824808b11b12b0601bf791960adc8b7792679c894438ceb838d299
BLAKE2b-256 checksum
How to use checksums
7b68ece7a0a2102c02c91c99bbed3723872943ba9202dd71999771544e03710a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.14

Release files / dz_speedtest_cli-2.2.1-py3-none-any.whl

Download URL dz_speedtest_cli-2.2.1-py3-none-any.whl
Size 25.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
5097cb4b39da52e8f74fd49b8dbe5276f3457a622371608b219d7252b369b63f
BLAKE2b-256 checksum
How to use checksums
071dc1d6050bc864ab219af6cc9215c2856f078d818cd5cfc6bdb66321c8e61b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.14

Release history Release notifications | RSS feed

This release

2.2.1 This release

2 release files

2.2.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page