{
  "id": "gdp",
  "version": "cea016e55a7c",
  "status": "published",
  "name": "GDP Calculator",
  "question": "What is the GDP from its parts?",
  "summary": "Computes gross domestic product by the expenditure approach, GDP = C + I + G + (X − M), with net exports, each part’s share, real GDP from a deflator, and GDP per person.",
  "category": "finance",
  "subcategory": "business",
  "url": "https://www.acalculator.org/finance/gdp-calculator",
  "markdown": "https://www.acalculator.org/finance/gdp-calculator.md",
  "kind": "function",
  "method": "GDP = C + I + G + (X − M); real GDP = GDP ÷ (deflator ÷ 100); GDP per person = GDP in dollars ÷ population.",
  "assumptions": [
    "The expenditure approach of the national accounts (BEA): consumption, investment, government, and exports minus imports.",
    "You type every amount, in one unit; no data is looked up.",
    "Real GDP uses the deflator you type, with its base year = 100."
  ],
  "inputs": {
    "$schema": "https://json-schema.org/draft/2020-12/schema",
    "type": "object",
    "properties": {
      "in": {
        "title": "Amounts are in",
        "description": "The unit every amount below is typed in: dollars, or thousands, millions, billions or trillions of dollars.",
        "type": "string",
        "enum": [
          "ones",
          "thousands",
          "millions",
          "billions",
          "trillions"
        ]
      },
      "c": {
        "title": "Consumption (C)",
        "description": "Personal consumption expenditures: what households spend on goods and services.",
        "type": "number",
        "minimum": 0,
        "maximum": 1000000000000000
      },
      "i": {
        "title": "Investment (I)",
        "description": "Gross private domestic investment: business equipment and buildings, new homes, and the change in inventories.",
        "type": "number",
        "minimum": -1000000000000000,
        "maximum": 1000000000000000
      },
      "g": {
        "title": "Government (G)",
        "description": "Government consumption expenditures and gross investment.",
        "type": "number",
        "minimum": 0,
        "maximum": 1000000000000000
      },
      "x": {
        "title": "Exports (X)",
        "description": "Goods and services sold to other countries.",
        "type": "number",
        "minimum": 0,
        "maximum": 1000000000000000
      },
      "m": {
        "title": "Imports (M)",
        "description": "Goods and services bought from other countries.",
        "type": "number",
        "minimum": 0,
        "maximum": 1000000000000000
      },
      "defl": {
        "title": "GDP deflator (price index)",
        "description": "The GDP price index for the year, with the base year = 100. Leave empty to skip real GDP.",
        "type": "number",
        "minimum": 0.001,
        "maximum": 100000
      },
      "pop": {
        "title": "Population",
        "description": "How many people live in the country. Leave empty to skip GDP per person.",
        "type": "integer",
        "minimum": 1,
        "maximum": 100000000000
      }
    }
  },
  "outputs": {
    "gdp": {
      "label": "GDP",
      "description": "C + I + G + (X − M), in the unit you chose.",
      "format": "number"
    },
    "text": {
      "label": "GDP in words",
      "description": "GDP with its unit, for example $20.9 trillion.",
      "format": "text"
    },
    "net": {
      "label": "Net exports (X − M)",
      "description": "Exports − imports: a trade surplus when positive, a deficit when negative.",
      "format": "number"
    },
    "cShare": {
      "label": "Consumption share",
      "description": "C ÷ GDP × 100.",
      "format": "percent"
    },
    "iShare": {
      "label": "Investment share",
      "description": "I ÷ GDP × 100.",
      "format": "percent"
    },
    "gShare": {
      "label": "Government share",
      "description": "G ÷ GDP × 100.",
      "format": "percent"
    },
    "nShare": {
      "label": "Net exports share",
      "description": "(X − M) ÷ GDP × 100.",
      "format": "percent"
    },
    "real": {
      "label": "Real GDP",
      "description": "GDP ÷ (deflator ÷ 100), in base-year dollars, in the unit you chose.",
      "format": "number"
    },
    "perPerson": {
      "label": "GDP per person",
      "description": "GDP in dollars ÷ population.",
      "format": "money"
    }
  },
  "defaultAnswer": {
    "inputs": {
      "in": "trillions",
      "c": 14,
      "i": 3.6,
      "g": 3.9,
      "x": 2.1,
      "m": 2.7
    },
    "outputs": {
      "gdp": 20.9,
      "text": "$20.9 trillion",
      "net": -0.6,
      "cShare": 66.98564593301435,
      "iShare": 17.22488038277512,
      "gShare": 18.660287081339714,
      "nShare": -2.8708133971291865
    },
    "text": "GDP = $20.9 trillion."
  },
  "examples": [
    {
      "given": {
        "in": "trillions",
        "c": 14,
        "i": 3.6,
        "g": 3.9,
        "x": 2.1,
        "m": 2.7
      },
      "expect": {
        "gdp": 20.9,
        "net": -0.6,
        "text": "$20.9 trillion"
      },
      "source": "OpenStax, Principles of Macroeconomics 3e, §6.1, Table 6.1 Components of U.S. GDP (consumption $14.0, investment $3.6, government $3.9, exports $2.1, imports −$2.7, total $20.9 trillion), https://openstax.org/books/principles-macroeconomics-3e/pages/6-1-measuring-the-size-of-the-economy-gross-domestic-product"
    },
    {
      "given": {
        "in": "billions",
        "c": 542.4,
        "i": 0,
        "g": 0,
        "x": 0,
        "m": 0,
        "defl": 16.6
      },
      "expect": {
        "real": 3267.4698795180725
      },
      "source": "OpenStax, Principles of Macroeconomics 3e, §6.2 Adjusting Nominal Values to Real Values (real GDP = nominal GDP ÷ (price index ÷ 100); 1960: $542.4 billion ÷ 0.166 = $3,267.5 billion), https://openstax.org/books/principles-macroeconomics-3e/pages/6-2-adjusting-nominal-values-to-real-values"
    },
    {
      "given": {
        "in": "trillions",
        "c": 14,
        "i": 3.6,
        "g": 3.9,
        "x": 2.1,
        "m": 2.7,
        "pop": 334000000
      },
      "expect": {
        "perPerson": 62574.850299401194,
        "cShare": 66.98564593301435
      },
      "source": "OpenStax, Principles of Macroeconomics 3e, §6.1, Table 6.1, https://openstax.org/books/principles-macroeconomics-3e/pages/6-1-measuring-the-size-of-the-economy-gross-domestic-product; hand calculation in content.mdx: 20,900,000,000,000 ÷ 334,000,000 = 62,574.85; 14 ÷ 20.9 = 67.0%"
    }
  ],
  "sources": [
    "U.S. Bureau of Economic Analysis (BEA), Gross Domestic Product (the value of the final goods and services produced in the United States; current-dollar or nominal vs. real or chained estimates). https://www.bea.gov/resources/learning-center/what-to-know-gdp (retrieved 2026-10-02)",
    "OpenStax, Principles of Macroeconomics 3e, §6.1 Measuring the Size of the Economy: Gross Domestic Product (GDP = C + I + G + (X − M); Table 6.1 Components of U.S. GDP: consumption $14.0, investment $3.6, government $3.9, exports $2.1, imports −$2.7, total $20.9 trillion). https://openstax.org/books/principles-macroeconomics-3e/pages/6-1-measuring-the-size-of-the-economy-gross-domestic-product (retrieved 2026-10-02)",
    "OpenStax, Principles of Macroeconomics 3e, §6.2 Adjusting Nominal Values to Real Values (real GDP = nominal GDP ÷ (price index ÷ 100); 1960: $542.4 billion, deflator 16.6, real GDP $3,267.5 billion). https://openstax.org/books/principles-macroeconomics-3e/pages/6-2-adjusting-nominal-values-to-real-values (retrieved 2026-10-02)"
  ],
  "related": [
    "inflation",
    "growth-rate",
    "cagr",
    "percentage"
  ],
  "changelog": []
}
