Limit Curl Download Speed and Bandwidth

This article explains how to restrict the download speed of the curl command-line tool to prevent it from consuming your entire network bandwidth. You will learn how to use the --limit-rate flag, understand the various speed unit suffixes, and view practical examples for limiting transfer rates.

To limit the download bandwidth in curl, you use the --limit-rate option followed by the maximum speed you want to allow. This is highly useful when downloading large files on a shared network or when you want to keep bandwidth free for other applications.

The Basic Syntax

The basic syntax for limiting the transfer rate is:

curl --limit-rate <amount> <URL>

The <amount> is represented by a number followed by an optional unit suffix. If you do not specify a suffix, curl interprets the number as bytes per second.

Speed Unit Suffixes

You can use the following case-insensitive suffixes to specify the speed limit:

Practical Examples

Limit download speed to 50 Kilobytes per second:

curl --limit-rate 50k https://example.com/largefile.zip -O

Limit download speed to 2 Megabytes per second:

curl --limit-rate 2m https://example.com/largefile.zip -O

Limit download speed to 1024 Bytes per second (no suffix):

curl --limit-rate 1024 https://example.com/largefile.zip -O

How the Limit Works

The --limit-rate option works by measuring the transfer speed over a span of a second and pausing the transfer if the speed exceeds the defined limit. Because it calculates the average speed over a short window, you might notice a brief burst of higher speed at the very beginning of the download before curl actively throttles the connection down to your specified limit.