Measuring Internet Speed In Python Using Speedtest-cli

4 is an excellent website that lets you measure your internet upload and download speed. It’s useful for checking the performance either for fault finding purposes or to see if you are getting the service promised by your ISP.

Matt Martz has created a Python project called speedtest-cli¬†which allows you to do a basic upload/download measurement using SpeedNet’s infrastructure. It works fine on the Pi and is really easy to try out on the command line.


Downloading the utility is easy if you clone the projects git repository :

git clone

Running SpeedTest

To run the script you need to navigate to the directory :

cd speedtest-cli

and then run the Python script :


The script will run and you should see something like this :


If you add –share to the command like this :

python --share

it will create a link to an online image showing your results which you can share with your friends/family/enemies.

speedtest-cli with share option

Here’s mine :

The results are slightly lower than the test on my main PC but this is to be expected as 85Mb/s is approaching the maximum data rate of the Pi’s 100Mb/s Ethernet port.

If you haven’t ever visited give it a try on your PC, Mac or laptop. Be sure to hit the oval “Begin Test” button in the centre of the page map rather than other buttons which may be adverts.



  1. How did you manage to get 85mbps on the PI?! i have Virgin 152mbps and the max i get is 15mbp through the speed test on the pi but on my laptop get over a 100+

Leave A Reply