Skip to content
ENExplore Calculators

GraphQL Complexity Calculator

Score GraphQL query cost from depth, breadth and list multipliers.

About GraphQL Complexity Calculator

Nested lists multiply rather than add, so cost grows exponentially with depth. A depth of five with ten items per level resolves over a hundred thousand nodes, which is why depth and complexity limits are a security control rather than a performance nicety. Without a complexity limit a single crafted query can exhaust a GraphQL server, which makes this a denial-of-service surface unique to flexible query APIs.

Formula

GraphQL Complexity

Complexity = Σ(list multiplier^level) × fields per level × cost per field

list multiplier
Each nested list multiplies the nodes resolved
complexity limit
Server-side cap that rejects expensive queries before execution

Worked example

With the default values below, GraphQL Complexity Calculator returns Query Complexity of 666,660. Change any input above and every figure here is recalculated in your browser.

Inputs used

Query depthaccepts 1–30
5
Fields per levelminimum 1
6
List size multiplier per levelminimum 1
10
Configured complexity limitminimum 1
1,000
Cost per fieldminimum 0.01
1

Results

Query Complexity
666,660
Worst Case Nodes Resolved
111,110
Share of the Limit Used
66,666.00%
Within the Limit
No
Maximum Depth Within the Limit
2

Step by step

  1. 1Values used
  2. 2GraphQL Complexity
  3. 3Query Complexity= 666,660
  4. 4Worst Case Nodes Resolved= 111,110
  5. 5Share of the Limit Used= 66,666.00
  6. 6Within the Limit= No
  7. 7Maximum Depth Within the Limit= 2

Assumptions and limits

  • The result is derived only from the 5 inputs listed above. Anything not among them is not part of the calculation.
  • In particular, this calculator does not take inflation, tax or compounding frequency into account.
  • Figures are rounded for display to 2 decimal places, so totals built from several rounded parts can differ slightly from the unrounded arithmetic.

How these calculators are built and tested is described on the Methodology page. If a figure looks wrong, please report it.

Frequently Asked Questions

How is GraphQL Complexity calculated?

Complexity = Σ(list multiplier^level) × fields per level × cost per field Nested lists multiply rather than add, so cost grows exponentially with depth. A depth of five with ten items per level resolves over a hundred thousand nodes, which is why depth and complexity limits are a security control rather than a performance nicety.

Why does GraphQL Complexity matter?

Without a complexity limit a single crafted query can exhaust a GraphQL server, which makes this a denial-of-service surface unique to flexible query APIs.

What values do I need to enter?

This calculator takes 5 inputs: Query depth, Fields per level, List size multiplier per level, Configured complexity limit, Cost per field. The pre-filled defaults are a realistic starting point — replace them with figures from your own environment for a result you can act on.

GraphQL Complexity Calculator – Calculate Query Complexity