Population living in slums (% of urban population)

Source: worldbank.org, 01.09.2025

Year: 2022

Flag Country Value Value change, % Rank
Aruba Aruba 0 158
Afghanistan Afghanistan 71.6 -2.33% 9
Angola Angola 62.7 +0.16% 17
Albania Albania 2.7 -3.57% 111
Andorra Andorra 0 158
United Arab Emirates United Arab Emirates 0.113 -50% 146
Argentina Argentina 14.5 0% 83
Armenia Armenia 8.39 0% 95
Antigua & Barbuda Antigua & Barbuda 2.65 +0.00151% 112
Australia Australia 0.035 0% 154
Austria Austria 0.0466 -98.9% 151
Burundi Burundi 36.8 -0.131% 57
Belgium Belgium 0 158
Benin Benin 64 -5.77% 16
Burkina Faso Burkina Faso 87.9 +231% 3
Bangladesh Bangladesh 51.5 -0.696% 28
Bulgaria Bulgaria 0.197 -21.4% 143
Bosnia & Herzegovina Bosnia & Herzegovina 0.313 0% 137
Belize Belize 15.7 0% 80
Bermuda Bermuda 0.0776 -22.4% 148
Bolivia Bolivia 46.6 0% 38
Brazil Brazil 14.9 0% 82
Brunei Brunei 21.6 -0.601% 71
Bhutan Bhutan 44.7 -11.4% 42
Botswana Botswana 39.6 0% 50
Central African Republic Central African Republic 68.9 0% 12
Canada Canada 1.1 +37% 122
Switzerland Switzerland 0 158
Chile Chile 7.32 +0.329% 98
China China 26.3 65
Côte d’Ivoire Côte d’Ivoire 48.3 -9.3% 36
Cameroon Cameroon 32.7 0% 63
Congo - Kinshasa Congo - Kinshasa 78.4 0% 6
Congo - Brazzaville Congo - Brazzaville 75.3 +70.5% 7
Colombia Colombia 9.7 0% 90
Comoros Comoros 48.5 -29.3% 34
Cape Verde Cape Verde 46.4 -0.566% 40
Costa Rica Costa Rica 3.55 0% 107
Cuba Cuba 11 +4.73% 88
Cayman Islands Cayman Islands 5.48 +32% 102
Cyprus Cyprus 0.272 -9.22% 140
Czechia Czechia 0.0274 -45.3% 155
Germany Germany 0 158
Djibouti Djibouti 48.7 -6.26% 33
Denmark Denmark 0 158
Dominican Republic Dominican Republic 11.2 0% 87
Algeria Algeria 13.2 -0.143% 85
Ecuador Ecuador 57.8 0% 22
Egypt Egypt 3.84 +327% 106
Eritrea Eritrea 48.7 -6.26% 33
Spain Spain 0.046 -7.94% 152
Estonia Estonia 0.345 +245% 135
Ethiopia Ethiopia 64.3 0% 15
Finland Finland 0 158
Fiji Fiji 9.4 0% 91
France France 0 158
Gabon Gabon 38.8 -12.5% 51
United Kingdom United Kingdom 0.163 +62.5% 144
Georgia Georgia 7.08 0% 100
Ghana Ghana 33.5 0% 62
Guinea Guinea 44 -10.3% 44
Gambia Gambia 37.1 -4.66% 56
Guinea-Bissau Guinea-Bissau 59 -2.98% 19
Equatorial Guinea Equatorial Guinea 64.7 -0.355% 14
Guatemala Guatemala 37.6 0% 55
Guam Guam 0.552 130
Guyana Guyana 11.3 -6.89% 86
Croatia Croatia 0.527 +111% 132
Haiti Haiti 51.1 +4.42% 29
Indonesia Indonesia 19.4 0% 72
Ireland Ireland 8.5 0% 94
Iran Iran 44.7 -11.4% 42
Iraq Iraq 49.3 0% 31
Iceland Iceland 0 158
Italy Italy 0.02 0% 156
Jamaica Jamaica 0.884 124
Japan Japan 2 117
Kazakhstan Kazakhstan 0.794 0% 125
Kenya Kenya 40.5 -20.3% 48
Kyrgyzstan Kyrgyzstan 2.44 0% 115
Cambodia Cambodia 42.3 +6.47% 45
Kiribati Kiribati 5.93 +5.97% 101
South Korea South Korea 4.5 -19.6% 104
Kuwait Kuwait 0 158
Laos Laos 54.8 +152% 26
Lebanon Lebanon 4.53 +0.689% 103
Liberia Liberia 60.5 -5.33% 18
Libya Libya 16.6 -30% 76
St. Lucia St. Lucia 0.441 -2.07% 134
Sri Lanka Sri Lanka 44.7 -11.4% 42
Lesotho Lesotho 25.6 0% 67
Lithuania Lithuania 0.509 +103% 133
Luxembourg Luxembourg 0.0173 0% 157
Latvia Latvia 0.593 -1.16% 129
Morocco Morocco 10.9 0% 89
Monaco Monaco 0 158
Madagascar Madagascar 65.7 -2.53% 13
Maldives Maldives 34.8 0% 59
Mexico Mexico 17.6 0% 74
Marshall Islands Marshall Islands 2.38 +6.96% 116
North Macedonia North Macedonia 0.278 +85.3% 139
Mali Mali 92.5 +121% 2
Malta Malta 0.0375 0% 153
Myanmar (Burma) Myanmar (Burma) 58.3 0% 21
Montenegro Montenegro 8.77 -0.35% 92
Mongolia Mongolia 17.9 0% 73
Northern Mariana Islands Northern Mariana Islands 0.2 142
Mozambique Mozambique 55 0% 24
Mauritania Mauritania 58.6 +4.57% 20
Mauritius Mauritius 48.7 -6.26% 33
Malawi Malawi 38 -23.7% 54
Namibia Namibia 41.4 0% 46
New Caledonia New Caledonia 0.25 141
Niger Niger 70.4 0% 10
Nigeria Nigeria 48.5 -0.99% 35
Netherlands Netherlands 0 158
Norway Norway 0 158
Nepal Nepal 40.1 -0.563% 49
Nauru Nauru 0.597 0% 128
New Zealand New Zealand 0 158
Oman Oman 0 158
Pakistan Pakistan 56 0% 23
Panama Panama 16.3 0% 78
Peru Peru 45.1 +3.03% 41
Philippines Philippines 35.9 -2.03% 58
Palau Palau 0.618 +106% 127
Papua New Guinea Papua New Guinea 22.3 -2.33% 70
Poland Poland 4.22 +14% 105
North Korea North Korea 23 69
Portugal Portugal 0.059 +17.9% 150
Paraguay Paraguay 15.1 0% 81
French Polynesia French Polynesia 1.5 119
Qatar Qatar 0 158
Romania Romania 2.52 +62.6% 114
Russia Russia 2.62 -4.77% 113
Rwanda Rwanda 38.3 0% 53
Saudi Arabia Saudi Arabia 0.55 131
Sudan Sudan 73.7 0% 8
Senegal Senegal 46.4 +46.8% 39
Singapore Singapore 0 158
Solomon Islands Solomon Islands 1.95 -0.0179% 118
Sierra Leone Sierra Leone 49.3 -2.7% 32
El Salvador El Salvador 16.5 -0.139% 77
Somalia Somalia 48.7 -6.26% 33
Serbia Serbia 1.42 +304% 120
South Sudan South Sudan 94.2 0% 1
São Tomé & Príncipe São Tomé & Príncipe 82.4 +56.6% 4
Suriname Suriname 15.8 0% 79
Slovakia Slovakia 0.066 +32% 149
Slovenia Slovenia 0.527 132
Sweden Sweden 0.336 +236% 136
Eswatini Eswatini 17 +57.3% 75
Sint Maarten Sint Maarten 2.89 109
Seychelles Seychelles 48.7 -6.26% 33
Syria Syria 41.1 +60.8% 47
Turks & Caicos Islands Turks & Caicos Islands 0.631 126
Chad Chad 82 0% 5
Togo Togo 38.5 -0.103% 52
Turkmenistan Turkmenistan 8.38 -1.46% 96
Timor-Leste Timor-Leste 33.9 +0.0605% 61
Tonga Tonga 0.308 -12.1% 138
Trinidad & Tobago Trinidad & Tobago 8.63 +15% 93
Tunisia Tunisia 7.64 0% 97
Turkey Turkey 14.1 0% 84
Tuvalu Tuvalu 50.9 +5,621% 30
Tanzania Tanzania 70.1 +71.4% 11
Uganda Uganda 52.7 -2.46% 27
Uruguay Uruguay 1.3 0% 121
United States United States 0.0932 -37.9% 147
Uzbekistan Uzbekistan 7.1 +56.8% 99
St. Vincent & Grenadines St. Vincent & Grenadines 2.76 110
Venezuela Venezuela 25.7 0% 66
British Virgin Islands British Virgin Islands 0.136 0% 145
U.S. Virgin Islands U.S. Virgin Islands 1.1 123
Vietnam Vietnam 32.5 +464% 64
Vanuatu Vanuatu 3.06 -26.2% 108
Samoa Samoa 34.6 +13,734% 60
Yemen Yemen 44.2 0% 43
South Africa South Africa 24.2 0% 68
Zambia Zambia 48.3 0% 37
Zimbabwe Zimbabwe 54.9 +154% 25

The indicator of "Population living in slums (% of urban population)" serves as a vital measure of urbanization challenges across the globe. This statistic reflects not only the living conditions faced by millions in urban environments but also the overall socioeconomic dynamics within countries. Slums are typically characterized by inadequate housing, lack of basic services, and a high degree of poverty. Understanding this indicator is essential to addressing urban development issues, housing policies, and district-level planning initiatives.

As of 2020, the median value for the global population living in slums was reported at 34.37%. This means that more than a third of urban dwellers live in substandard conditions marked by insufficient access to clean water, sanitation, and secure housing. The implications of this statistic are far-reaching; it indicates systemic failures in urban planning, economic instability, and often, social inequality. Countries with high percentages of slum dwellers face heightened risks of crime, health epidemics, and social unrest due to the crowded and unsanitary environments.

In examining the top five areas with the highest percentages of the urban population living in slums, we see alarming figures. Chad leads with 82.0%, while Congo - Kinshasa follows closely at 78.36%. Sudan and Afghanistan also report significant percentages at 73.7% and 73.3%, respectively, with Benin at 67.93%. These numbers are indicative of severe economic challenges, continuous conflicts, and ineffective governance structures that further exacerbate living conditions in these nations. The prevalence of slums in high-percentage areas often correlates with weak infrastructure, limited employment opportunities, and lack of political stability. This connection between slum prevalence and broader issues of governance cannot be overstated; it is a cycle where poverty breeds instability and vice versa.

Conversely, we can look at the bottom five areas where the population living in slums is significantly lower. Kazakhstan, for example, reports merely 0.79%, followed by Belarus at 2.28%, and Kyrgyzstan at 2.44%. Other countries like Albania and Costa Rica show percentages of 2.8% and 3.55%, respectively. These countries often benefit from better economic stability, more robust infrastructure, and government policies aimed at urban development and social welfare. Their low slum population rates suggest that sound urban planning, a focus on affordable housing, and effective socio-economic policies can lead to improved living conditions in urban areas.

The importance of understanding the percentage of the population living in slums lies not only in measuring current living conditions but also in informing future policies. Urbanization is inevitable, and as cities continue to grow, so too does the necessity for sustainable urban planning strategies. This statistic directly connects to various other indicators, including GDP per capita, education levels, healthcare access, and employment rates. Lower levels of slum living often correlate with higher educational attainment and better health outcomes, indicating that investments in these sectors can have compounded benefits for urban populations.

Several factors affect the prevalence of slum populations. Urban migration, often driven by the allure of economic opportunities in cities, contributes significantly to slum expansion. As rural inhabitants move to urban areas seeking better livelihoods, they frequently settle in informal housing due to limited availability of affordable housing. Additionally, economic policies that fail to keep pace with urban growth exacerbate the issue, as do social factors like discrimination and economic inequality. Proactive measures are vital to counteract these influences; governments can prioritize inclusive housing policies and improve social services to provide better living conditions.

Strategies to tackle the problem of slum populations must be comprehensive and multifaceted. Governments can invest in infrastructure development, increase access to affordable housing, and implement zoning reforms that allow for the equitable distribution of resources. Additionally, enhancing access to education and skill-building programs can empower communities and uplift individuals, reducing their vulnerability to slum conditions. Furthermore, collaborative approaches that involve local communities, NGOs, and the private sector can generate innovative solutions tailored to specific urban contexts.

While many strategies have been proposed and implemented to alleviate slum living conditions, flaws still exist in their execution. For instance, prioritizing economic development often results in the displacement of existing slum communities under the guise of urban redevelopment. Such actions may lead to further marginalization and exacerbate existing inequities. Additionally, the lack of sufficient data and ongoing community engagement can result in poorly informed policies that do not address the specific needs of affected populations. Addressing these flaws necessitates ongoing dialogue with community leaders and residents to ensure that solutions are both relevant and sustainable.

In conclusion, the indicator of "Population living in slums (% of urban population)" provides critical insights into the challenges faced by urban populations, especially in developing nations. The wide disparity in slum populations across regions highlights the links between governance, economic stability, and living conditions. As urbanization continues to accelerate, it is imperative that policymakers adopt comprehensive, inclusive strategies that address the root causes of slum proliferation while leveraging opportunities to build healthier, more sustainable urban environments. Only then can we hope to see a significant reduction in the number of people living in slums worldwide.

                    
# Install missing packages
import sys
import subprocess

def install(package):
subprocess.check_call([sys.executable, "-m", "pip", "install", package])

# Required packages
for package in ['wbdata', 'country_converter']:
try:
__import__(package)
except ImportError:
install(package)

# Import libraries
import wbdata
import country_converter as coco
from datetime import datetime

# Define World Bank indicator code
dataset_code = 'EN.POP.SLUM.UR.ZS'

# Download data from World Bank API
data = wbdata.get_dataframe({dataset_code: 'value'},
date=(datetime(1960, 1, 1), datetime.today()),
parse_dates=True,
keep_levels=True).reset_index()

# Extract year
data['year'] = data['date'].dt.year

# Convert country names to ISO codes using country_converter
cc = coco.CountryConverter()
data['iso2c'] = cc.convert(names=data['country'], to='ISO2', not_found=None)
data['iso3c'] = cc.convert(names=data['country'], to='ISO3', not_found=None)

# Filter out rows where ISO codes could not be matched — likely not real countries
data = data[data['iso2c'].notna() & data['iso3c'].notna()]

# Sort for calculation
data = data.sort_values(['iso3c', 'year'])

# Calculate YoY absolute and percent change
data['value_change'] = data.groupby('iso3c')['value'].diff()
data['value_change_percent'] = data.groupby('iso3c')['value'].pct_change() * 100

# Calculate ranks (higher GDP per capita = better rank)
data['rank'] = data.groupby('year')['value'].rank(ascending=False, method='dense')

# Calculate rank change from previous year
data['rank_change'] = data.groupby('iso3c')['rank'].diff()

# Select desired columns
final_df = data[['country', 'iso2c', 'iso3c', 'year', 'value',
'value_change', 'value_change_percent', 'rank', 'rank_change']].copy()

# Optional: Add labels as metadata (could be useful for export or UI)
column_labels = {
'country': 'Country name',
'iso2c': 'ISO 2-letter country code',
'iso3c': 'ISO 3-letter country code',
'year': 'Year',
'value': 'GDP per capita (current US$)',
'value_change': 'Year-over-Year change in value',
'value_change_percent': 'Year-over-Year percent change in value',
'rank': 'Country rank by GDP per capita (higher = richer)',
'rank_change': 'Change in rank from previous year'
}

# Display first few rows
print(final_df.head(10))

# Optional: Save to CSV
#final_df.to_csv("gdp_per_capita_cleaned.csv", index=False)
                    
                
                    
# Check and install required packages
required_packages <- c("WDI", "countrycode", "dplyr")

for (pkg in required_packages) {
  if (!requireNamespace(pkg, quietly = TRUE)) {
    install.packages(pkg)
  }
}

# Load the necessary libraries
library(WDI)
library(dplyr)
library(countrycode)

# Define the dataset code (World Bank indicator code)
dataset_code <- 'EN.POP.SLUM.UR.ZS'

# Download data using WDI package
dat <- WDI(indicator = dataset_code)

# Filter only countries using 'is_country' from countrycode
# This uses iso2c to identify whether the entry is a recognized country
dat <- dat %>%
  filter(countrycode(iso2c, origin = 'iso2c', destination = 'country.name', warn = FALSE) %in%
           countrycode::codelist$country.name.en)

# Ensure dataset is ordered by country and year
dat <- dat %>%
  arrange(iso3c, year)

# Rename the dataset_code column to "value" for easier manipulation
dat <- dat %>%
  rename(value = !!dataset_code)

# Calculate year-over-year (YoY) change and percentage change
dat <- dat %>%
  group_by(iso3c) %>%
  mutate(
    value_change = value - lag(value),                              # Absolute change from previous year
    value_change_percent = 100 * (value - lag(value)) / lag(value) # Percent change from previous year
  ) %>%
  ungroup()

# Calculate rank by year (higher value => higher rank)
dat <- dat %>%
  group_by(year) %>%
  mutate(rank = dense_rank(desc(value))) %>% # Rank countries by descending value
  ungroup()

# Calculate rank change (positive = moved up, negative = moved down)
dat <- dat %>%
  group_by(iso3c) %>%
  mutate(rank_change = rank - lag(rank)) %>% # Change in rank compared to previous year
  ungroup()

# Select and reorder final columns
final_data <- dat %>%
  select(
    country,
    iso2c,
    iso3c,
    year,
    value,
    value_change,
    value_change_percent,
    rank,
    rank_change
  )

# Add labels (variable descriptions)
attr(final_data$country, "label") <- "Country name"
attr(final_data$iso2c, "label") <- "ISO 2-letter country code"
attr(final_data$iso3c, "label") <- "ISO 3-letter country code"
attr(final_data$year, "label") <- "Year"
attr(final_data$value, "label") <- "GDP per capita (current US$)"
attr(final_data$value_change, "label") <- "Year-over-Year change in value"
attr(final_data$value_change_percent, "label") <- "Year-over-Year percent change in value"
attr(final_data$rank, "label") <- "Country rank by GDP per capita (higher = richer)"
attr(final_data$rank_change, "label") <- "Change in rank from previous year"

# Print the first few rows of the final dataset
print(head(final_data, 10))