Military expenditure (current US$)

Source: worldbank.org, 07.12.2025

Year: 2023

Flag Country Value Value change, % Rank
Angola Angola 1,270,158,265 -21.7% 68
Albania Albania 397,617,613 +73.9% 103
Argentina Argentina 3,121,892,360 -28% 52
Armenia Armenia 1,329,532,625 +67.2% 67
Australia Australia 32,340,013,665 -0.325% 13
Austria Austria 4,409,985,264 +22.1% 44
Azerbaijan Azerbaijan 3,561,670,588 +19.1% 49
Burundi Burundi 147,289,297 +45.2% 122
Belgium Belgium 7,629,396,589 +10.7% 33
Benin Benin 140,776,011 +28% 124
Burkina Faso Burkina Faso 826,357,641 +46.9% 83
Bangladesh Bangladesh 4,207,971,901 -5.94% 47
Bulgaria Bulgaria 1,918,445,358 +33.5% 62
Bahrain Bahrain 1,383,776,596 +0.178% 66
Bosnia & Herzegovina Bosnia & Herzegovina 216,702,020 +30.1% 118
Belarus Belarus 1,403,134,160 +27% 65
Belize Belize 26,451,513 +9.35% 142
Bolivia Bolivia 644,276,786 +50.1% 89
Brazil Brazil 22,887,482,838 +11.4% 18
Brunei Brunei 448,911,491 +3% 98
Botswana Botswana 511,929,919 +5.53% 92
Central African Republic Central African Republic 62,321,710 +48.4% 137
Canada Canada 27,221,543,361 +6.47% 16
Switzerland Switzerland 6,293,390,648 +11.3% 35
Chile Chile 5,491,661,224 +18.1% 39
China China 296,438,564,343 +1.53% 2
Côte d’Ivoire Côte d’Ivoire 681,518,424 +12.2% 86
Cameroon Cameroon 456,128,244 +9.48% 96
Congo - Kinshasa Congo - Kinshasa 794,244,598 +114% 84
Congo - Brazzaville Congo - Brazzaville 284,719,248 +7.1% 110
Colombia Colombia 10,701,082,030 +10.8% 24
Cape Verde Cape Verde 13,191,423 +28.7% 147
Costa Rica Costa Rica 0 150
Cyprus Cyprus 566,873,090 +6.45% 90
Czechia Czechia 5,056,277,310 +26.2% 43
Germany Germany 66,826,634,284 +19% 7
Denmark Denmark 8,144,932,202 +48.8% 30
Dominican Republic Dominican Republic 893,165,643 +17.4% 81
Algeria Algeria 18,263,967,968 +99.7% 19
Ecuador Ecuador 2,726,300,000 +5.41% 56
Egypt Egypt 3,164,630,287 -31.9% 51
Spain Spain 23,699,130,514 +16.7% 17
Estonia Estonia 1,189,493,563 +45.4% 73
Ethiopia Ethiopia 1,226,452,568 +18.9% 71
Finland Finland 7,348,032,204 +65.3% 34
Fiji Fiji 72,459,177 +7.54% 135
France France 61,301,290,833 +14.3% 9
Gabon Gabon 265,129,555 -4.52% 114
United Kingdom United Kingdom 74,942,843,460 +16.9% 6
Georgia Georgia 504,612,282 +40% 93
Ghana Ghana 285,375,935 +24.5% 109
Guinea Guinea 504,474,310 +14.3% 94
Gambia Gambia 13,785,997 -9.33% 146
Guinea-Bissau Guinea-Bissau 25,267,971 +2.97% 143
Equatorial Guinea Equatorial Guinea 162,035,787 +3.34% 120
Greece Greece 7,729,763,484 -11.6% 32
Guatemala Guatemala 422,271,566 -4.33% 100
Guyana Guyana 96,207,956 +9.08% 132
Honduras Honduras 539,833,990 +17.8% 91
Croatia Croatia 1,439,060,332 +12.2% 64
Haiti Haiti 11,654,567 -8.26% 148
Hungary Hungary 4,355,478,070 +33.7% 45
Indonesia Indonesia 9,480,833,558 -6.44% 26
India India 83,574,568,840 +4.5% 4
Ireland Ireland 1,269,192,873 +9.01% 69
Iran Iran 10,283,084,402 +40.2% 25
Iraq Iraq 5,108,397,154 +9.08% 42
Iceland Iceland 0 150
Israel Israel 27,498,527,857 +17.5% 15
Italy Italy 35,528,923,816 +2.41% 12
Jamaica Jamaica 230,617,195 +4.57% 117
Jordan Jordan 2,450,239,103 +5.46% 59
Japan Japan 50,161,085,002 +7% 10
Kazakhstan Kazakhstan 1,236,289,860 +6.3% 70
Kenya Kenya 999,541,976 -13.5% 77
Kyrgyzstan Kyrgyzstan 464,581,470 +31.9% 95
Cambodia Cambodia 667,985,733 +7.97% 87
South Korea South Korea 47,925,588,087 +3.36% 11
Kuwait Kuwait 7,755,031,936 -5.93% 31
Lebanon Lebanon 241,290,151 +10.3% 115
Liberia Liberia 37,153,000 +1.03% 139
Sri Lanka Sri Lanka 1,165,824,640 +16.3% 74
Lesotho Lesotho 33,954,038 -2.06% 141
Lithuania Lithuania 2,160,751,250 +24.6% 60
Luxembourg Luxembourg 662,492,816 +29.9% 88
Latvia Latvia 1,045,283,944 +22.1% 76
Morocco Morocco 5,184,928,400 +3.8% 41
Moldova Moldova 93,410,827 +95.6% 134
Madagascar Madagascar 102,131,129 +4.06% 130
Mexico Mexico 11,825,909,998 +17.5% 23
North Macedonia North Macedonia 266,629,713 +21.1% 113
Mali Mali 784,506,782 +34.8% 85
Malta Malta 112,636,722 +43.8% 129
Myanmar (Burma) Myanmar (Burma) 2,493,486,451 +0.144% 58
Montenegro Montenegro 114,519,816 +16.8% 128
Mongolia Mongolia 147,813,417 +37.5% 121
Mozambique Mozambique 376,385,190 +33.5% 105
Mauritania Mauritania 277,161,496 +23% 111
Mauritius Mauritius 22,547,740 +26.1% 144
Malawi Malawi 135,319,773 +15.1% 126
Malaysia Malaysia 3,899,141,126 +6.13% 48
Namibia Namibia 338,245,822 -7.98% 107
Niger Niger 331,596,822 +36.7% 108
Nigeria Nigeria 3,191,915,666 +2.65% 50
Nicaragua Nicaragua 94,387,888 +12.1% 133
Netherlands Netherlands 16,624,820,117 +22% 20
Norway Norway 8,668,565,966 -0.336% 28
Nepal Nepal 418,905,096 +0.338% 101
New Zealand New Zealand 3,029,024,715 +7.07% 53
Oman Oman 5,851,755,527 +1.18% 36
Pakistan Pakistan 8,521,159,037 -17.7% 29
Panama Panama 0 150
Peru Peru 3,000,769,179 +7.2% 54
Philippines Philippines 5,451,725,465 +2.44% 40
Papua New Guinea Papua New Guinea 97,043,687 -0.456% 131
Poland Poland 31,649,874,712 +106% 14
Portugal Portugal 4,223,188,318 +18.4% 46
Paraguay Paraguay 397,871,087 +8.8% 102
Romania Romania 5,610,688,108 +8.15% 38
Russia Russia 109,454,387,532 +6.92% 3
Rwanda Rwanda 178,588,082 +1.22% 119
Saudi Arabia Saudi Arabia 75,813,333,333 +6.9% 5
Senegal Senegal 448,607,460 +6.55% 99
Singapore Singapore 13,200,743,481 +9.7% 22
Sierra Leone Sierra Leone 22,426,022 -19.9% 145
El Salvador El Salvador 453,700,000 -1.05% 97
Somalia Somalia 143,465,000 +26.2% 123
Serbia Serbia 2,135,767,103 +23.9% 61
South Sudan South Sudan 1,076,166,129 +107% 75
Slovakia Slovakia 2,663,125,916 +27.7% 57
Slovenia Slovenia 907,515,525 +17.1% 79
Sweden Sweden 8,754,872,951 +13.4% 27
Eswatini Eswatini 67,795,175 -8.76% 136
Seychelles Seychelles 35,926,984 +42.8% 140
Chad Chad 372,391,939 +12.3% 106
Togo Togo 276,349,077 -17.9% 112
Thailand Thailand 5,765,771,787 -4.4% 37
Tajikistan Tajikistan 139,525,232 -31.6% 125
Timor-Leste Timor-Leste 55,111,000 +24.4% 138
Trinidad & Tobago Trinidad & Tobago 240,704,331 +10.8% 116
Tunisia Tunisia 1,208,204,190 +4.5% 72
Turkey Turkey 15,827,853,255 +46.8% 21
Tanzania Tanzania 905,071,614 +8.75% 80
Uganda Uganda 976,660,986 +5.61% 78
Ukraine Ukraine 64,753,191,604 +57.2% 8
Uruguay Uruguay 1,590,099,177 +22.5% 63
United States United States 916,014,700,000 +6.43% 1
Venezuela Venezuela 3,917,057 -15.3% 149
Kosovo Kosovo 133,185,466 +23.8% 127
South Africa South Africa 2,781,117,202 -10.6% 55
Zambia Zambia 377,172,056 +15.7% 104
Zimbabwe Zimbabwe 870,433,538 +162% 82

Military expenditure, often represented as military spending in current US dollars, is a critical indicator that reflects a nation's financial commitment to defense and military capabilities. It encompasses all government expenditures on military activities, including funding for the armed forces, defense research and development, and procurement of military equipment. As of 2023, the total global military expenditure has reached approximately 2.39 trillion US dollars, continuing an upward trajectory seen over the past several decades.

The importance of military expenditure cannot be overstated; it serves as a vital metric of a country's military readiness, strategic priorities, and geopolitical positioning. Nations with higher military budgets are often perceived as more powerful and influential on the global stage, and this can lead to shifts in international relations and alliances. This expenditure can significantly impact domestic and foreign policy, including national security strategies and defense diplomacy.

When analyzing military expenditure, one must consider its correlation with various political and economic indicators. For instance, countries with larger economies, such as the United States and China, often allocate substantial portions of their GDP towards defense spending. The U.S., for example, led the world with military expenditures around 916 billion dollars in 2023, accounting for a significant percentage of its GDP. Comparatively, China's military spending reached approximately 296 billion dollars, illustrating its growing emphasis on military modernization and regional assertiveness.

Another essential aspect to consider is how military expenditure relates to factors such as regional conflicts, perceived threats, and technological advancements. Countries in conflict-prone regions or those facing tensions with neighbors may ramp up their military spending as a proactive measure to safeguard national interests and security. For instance, India, which spends around 83.5 billion dollars on military, reflects its ongoing strategic challenges in the South Asian region, particularly with its rival, Pakistan, and the influence of China.

On the opposite end of the spectrum, military expenditure can also underscore economic disparities and social priorities within countries. For instance, the bottom five nations in terms of military spending include Costa Rica, Iceland, and Panama, reflecting their pacifistic stances or smaller economies that prioritize social services over military might. Costa Rica, notably, has no standing army and allocates resources to education and healthcare instead. The small military budgets of these nations represent a stark contrast to the enormous spending undertaken by superpowers, highlighting a broader narrative of global military inequality.

The rising military expenditures globally can often be driven by various factors, including technological advancements, public perceptions of security threats, and international conflicts. Nations may invest heavily in new technologies such as cyber warfare capabilities, unmanned systems, and advanced missile defense systems, which can inflate overall military budgets. Additionally, the ongoing geopolitical tensions in regions like Eastern Europe and the South China Sea have also influenced many countries to reassess their defense postures and spending strategies.

Strategies to manage military expenditure effectively include fostering international cooperation and embracing arms control agreements. By collaborating on security issues and engaging in dialogue, nations can find common ground to mitigate the arms race and divert resources towards pressing social challenges. Furthermore, budgeting practices that prioritize transparency and efficiency in military spending can ensure that funds are used effectively without excessive waste.

However, reliance on military expenditure as a measure of security can sometimes be a flawed approach. An overemphasis on military spending can lead to neglect in essential areas such as education, healthcare, and infrastructure, which are equally crucial for sustainable national development. Additionally, high military budgets can foster an environment of militarization within societies, potentially leading to human rights abuses or conflicts. This juxtaposition of military readiness versus social development creates a complex challenge for policymakers seeking to balance security needs and socio-economic priorities.

In conclusion, military expenditure is a multifaceted indicator that reflects a nation's defense priorities, economic capabilities, and geopolitical relationships. The 2023 figures show the ongoing trend of increased global military spending, escalating particularly among major powers. As countries navigate their security environments amid shifting international dynamics, the conversation around military expenditure must also address underlying social issues and the implications of excessive militarization. Striking a balance between defense spending and essential public services will require innovative strategies, collaborative approaches, and critical evaluation of national security policies moving forward.

                    
# 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 = 'MS.MIL.XPND.CD'

# 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 <- 'MS.MIL.XPND.CD'

# 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))