There are many symbols for understanding internet-related properties: $NetworkConnected, PingTime, NetworkPacketTrace, NetworkPacketRecording, etc.

But is there any convenient way of testing your network's upload speed from within Mathematica?


The easiest method I can think of to get an estimate is to upload a file to a server and measure how long it takes. Should give a reasonable guess, but like all of these things, it can only be a guess. In this example latency to WRI's servers may add a lot.

file = "mytestfile";

time = AbsoluteTiming[CopyFile[file, CloudObject["speedtest"]]]


size = FileSize[file]

Quantity[98.5052, "Megabytes"]

speed = size/Quantity[time, "Seconds"]

Quantity[2.72684, ("Megabytes")/("Seconds")]

So in this case it gives my speed as 2.72MB/s. This is reasonably close to my actual upload speed of 5MB/s. I re-ran and it gave me 4.74MB/s, which is pretty on the money. You could use RepeatedTiming instead of AbsoluteTiming to give a better estimate, but how long you want to run for and the size of the file is pretty much up to you.

You can replace CloudObject with RemoteFile, an scp or ftp link, a Url and other options described in the documentation if you don't have a Wolfram Cloud account. This also allows you to control for the download speed of the server you're sending the file to.

  • 1
    $\begingroup$ This depends on having a wolfram cloud account connected though $\endgroup$
    – user5601
    Feb 26 '20 at 20:58
  • 1
    $\begingroup$ Fair enough, but you could do it this way with any remote server or file upload repository. If you have a remote server you have access to, do RemoteFile instead of CloudObject. Or the second argument could be an scp link, or ftp, etc. $\endgroup$
    – Carl Lange
    Feb 26 '20 at 21:35
  • $\begingroup$ I updated my answer to add those details. $\endgroup$
    – Carl Lange
    Feb 26 '20 at 21:50

Here is another way. Install the speedtest cli application for your OS from here.

SetEnvironment["PATH" -> Environment["PATH"] <> "path to install dir"]

output = RunProcess[{"speedtest", "-fcsv", "--output-header"}, "StandardOutput"];

output // ImportString[#, "CSV"] & // 
  Part[#, All, 3 ;; -2] & (* Remove personal info *) //

enter image description here


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.