Rail lines (total route-km)
Real data: World Bank, World Development Indicators, indicator IS.RRS.TOTL.KM, retrieved 19 November 2026. Values are as published; we only reshaped the file.
What it measures
The total length of rail line in the country operated for passenger transport, goods transport, or both.
Limits and exceptions (World Bank note)
Data for transport sectors are not always internationally comparable. Unlike for demographic statistics, national income accounts, and international trade data, the collection of infrastructure data has not been "internationalized". The data from UIC is based on voluntary reporting by railway companies, and can show drastic increases or decreases for some of the years due to lack of reporting by some of the companies in that country.
The numbers in 2021
In 2021, 65 countries have a value. The highest is United States (148,553); the lowest is Hong Kong SAR, China (230.1). The median country value is 3,159.
Top 10 countries, 2021
total route-km
Highest, 2021
| # | Country | Value |
|---|---|---|
| 1 | United States | 148,553 |
| 2 | China | 109,767 |
| 3 | Russian Federation | 85,544 |
| 4 | India | 68,103 |
| 5 | Canada | 48,150 |
| 6 | Germany | 33,401 |
| 7 | France | 27,716 |
| 8 | South Africa | 20,953 |
| 9 | Poland | 18,620 |
| 10 | Italy | 17,305 |
Lowest, 2021
| # | Country | Value |
|---|---|---|
| 1 | Hong Kong SAR, China | 230.1 |
| 2 | Luxembourg | 271 |
| 3 | United Arab Emirates | 279 |
| 4 | Kyrgyz Republic | 417 |
| 5 | Burkina Faso | 518 |
| 6 | Tajikistan | 620 |
| 7 | Cote d'Ivoire | 639 |
| 8 | Gabon | 648 |
| 9 | Madagascar | 673 |
| 10 | North Macedonia | 683 |
How many countries report, by decade
| Decade | Most countries in one year |
|---|---|
| 1990s | 98 |
| 2000s | 92 |
| 2010s | 78 |
| 2020s | 66 |
First rows
rail-lines-total-route-km.csv
| countrytext | iso3text | regiontext | income_grouptext | yearnumber | valuenumber |
|---|---|---|---|---|---|
| Albania | ALB | Europe & Central Asia | Upper middle income | 1995 | 674 |
| Albania | ALB | Europe & Central Asia | Upper middle income | 1996 | 447 |
| Albania | ALB | Europe & Central Asia | Upper middle income | 1997 | 447 |
| Albania | ALB | Europe & Central Asia | Upper middle income | 1998 | 447 |
| Albania | ALB | Europe & Central Asia | Upper middle income | 1999 | 440 |
| Albania | ALB | Europe & Central Asia | Upper middle income | 2000 | 440 |
| Albania | ALB | Europe & Central Asia | Upper middle income | 2001 | 447 |
| Albania | ALB | Europe & Central Asia | Upper middle income | 2002 | 447 |
Data dictionary
| Column | Type | Meaning |
|---|---|---|
| country | text | Country or economy, World Bank name |
| iso3 | text | ISO 3166-1 alpha-3 code |
| region | text | World Bank region |
| income_group | text | World Bank income group |
| year | number | Calendar year of the value |
| value | number | Rail lines (total route-km), exactly as the World Bank API returns it (not rounded) |
Only country-years with a value are in the long file; blank cells in the wide file mean no value was published.
Practice questions
answers computed from the file
Which country has the highest value in 2021?
United States, with 148,553.
Excel (on the long CSV: E = year, F = value)
=FILTER(A2:A100000,(E2:E100000=2021)*(F2:F100000=MAXIFS(F2:F100000,E2:E100000,2021)))SQL (table wb = the CSV)
SELECT country, value FROM wb WHERE year = 2021
AND value = (SELECT MAX(value) FROM wb WHERE year = 2021);pandas (df = pd.read_csv("rail-lines-total-route-km.csv"))
y = df[df.year == 2021]
y[y.value == y.value.max()][["country", "value"]]File: rail-lines-total-route-km.csv
How many countries report a value for 2021?
65 of the 217 economies in the file's country list.
Excel (on the long CSV: E = year, F = value)
=COUNTIF(E2:E100000,2021)SQL (table wb = the CSV)
SELECT COUNT(*) FROM wb WHERE year = 2021;pandas (df = pd.read_csv("rail-lines-total-route-km.csv"))
(df.year == 2021).sum()File: rail-lines-total-route-km.csv
What is the median across countries in 2021?
3,159 (median of the 65 country values; not a World Bank aggregate).
Excel (on the long CSV: E = year, F = value)
=MEDIAN(FILTER(F2:F100000,E2:E100000=2021))SQL (table wb = the CSV)
-- SQLite has no MEDIAN(); this picks the middle value(s)
SELECT AVG(value) FROM (SELECT value FROM wb WHERE year = 2021 ORDER BY value
LIMIT 2 - (SELECT COUNT(*) FROM wb WHERE year = 2021) % 2
OFFSET (SELECT (COUNT(*) - 1) / 2 FROM wb WHERE year = 2021));pandas (df = pd.read_csv("rail-lines-total-route-km.csv"))
df[df.year == 2021]["value"].median()File: rail-lines-total-route-km.csv
Which country rose the most between 2011 and 2021?
China: from 72,487 to 109,767, a rise of 37,280 (out of 52 countries with both years).
Excel (on the long CSV: E = year, F = value)
Use the wide file (rail-lines-total-route-km-wide.csv): add a column = [2021] - [2011], then sort it largest to smallest.SQL (table wb = the CSV)
SELECT a.country, b.value - a.value AS rise FROM wb a JOIN wb b ON a.iso3 = b.iso3
WHERE a.year = 2011 AND b.year = 2021 ORDER BY rise DESC LIMIT 1;pandas (df = pd.read_csv("rail-lines-total-route-km.csv"))
w = df.pivot(index="country", columns="year", values="value")
(w[2021] - w[2011]).dropna().nlargest(1)File: rail-lines-total-route-km.csv
Which year has the most countries reporting?
1999, with 98 countries. (Later years are still filling in as countries report.)
Excel (on the long CSV: E = year, F = value)
Make a pivot table: year in Rows, Count of value in Values, then sort by the count.SQL (table wb = the CSV)
SELECT year, COUNT(*) AS n FROM wb GROUP BY year ORDER BY n DESC, year DESC LIMIT 1;pandas (df = pd.read_csv("rail-lines-total-route-km.csv"))
df.groupby("year").size().sort_values(ascending=False).head(1)File: rail-lines-total-route-km.csv