StatGardenREF. DESK
Calculators/Maths/Trapezoidal Rule
Maths

Trapezoidal Rule calculator

Approximates the area under a curve (a definite integral) from a set of x,y data points using the trapezoidal rule.

Published 21 August 2026

What this calculator does

The trapezoidal rule approximates the area under a curve, or a definite integral, by joining consecutive data points with straight lines and adding up the area of the resulting trapezoids. It is one of the most common numerical integration methods, useful whenever the underlying function is not known in a form that can be integrated directly, or when all you have to work with is a set of measured or sampled points.

This is a different trapezoidal calculation from finding the plain area of a trapezoid shape: the trapezoidal rule uses trapezoids as a tool for approximating the area under any curve made of several data points, not the area of one single four-sided figure. Enter matching x and y values, in increasing order of x, and the total approximate area comes out along with the contribution from each subinterval.

The formula

FormulaArea ≈ Σ (x[i+1] − x[i]) × (y[i] + y[i+1]) / 2

For each pair of consecutive points, the trapezoidal rule treats the curve between them as a straight line and calculates the area of the trapezoid formed with the x-axis: the width of that interval, (x[i+1] − x[i]), times the average of the two y-values, (y[i] + y[i+1]) ÷ 2. Adding up every such trapezoid gives the total approximate area.

TermMeaning
x, y valuesThe coordinates of each data point, in increasing order of x.
SubintervalThe gap between one x value and the next.
Trapezoid areaThe area contributed by a single subinterval: width × average height.
Definite integralThe exact area under a curve between two points, which the trapezoidal rule approximates.

The inputs explained

FieldWhat to enter
x values (comma separated, increasing)The x-coordinates of each data point, separated by commas, listed in increasing order.
y values (comma separated, same order)The corresponding y-coordinates, in the same order as the x values. Both lists need at least two matching pairs.

When to use it

Estimating area under a curve from sampled data

Sensor readings, experimental measurements or any other data collected at intervals can be integrated numerically this way, without needing a formula for the underlying curve at all.

Approximating a definite integral by hand or for a check

Sampling a known function at several x values and applying the trapezoidal rule gives a quick numerical check against a definite integral worked out analytically.

Comparing accuracy at different levels of detail

Using more, closely spaced data points generally brings the trapezoidal approximation closer to the true area, since each individual straight-line segment then has to bend less to follow the real curve.

Worked examples

Every figure in the tables below is produced by this page’s own calculator at build time, so the numbers and the tool always agree. Select any row to load that scenario.

Trapezoidal rule area for different curve shapes

The same six evenly spaced x values, with the y values changing to trace out different curve shapes.

x = 0, 1, 2, 3, 4, 5 in every row
Y valuesApproximate area under the curveNumber of subintervals
0, 1, 4, 9, 16, 2542.5005
5, 5, 5, 5, 5, 525.0005
0, 2, 0, 2, 0, 25.0005
0, 1, 2, 3, 4, 512.5005
The constant row (all y = 5) gives an exact result, since a flat line is already a perfect fit for straight-line trapezoids. The rising-parabola row (y = x²) slightly overstates the true integral, a known bias of the trapezoidal rule on curves that bow away from the straight-line segments joining them.

How area scales with the spacing between x values

The same five y values, with the spacing of the x values stretched or compressed.

y = 0, 3, 4, 3, 0 in every row
X valuesApproximate area under the curve
0, 0.5, 1, 1.5, 25.000
0, 1, 2, 3, 410.000
0, 2, 4, 6, 820.000
0, 5, 10, 15, 2050.000
With the same y values throughout, doubling the spacing between x values doubles every subinterval width and therefore doubles the total area, since each trapezoid's area scales directly with its width.

Questions

Is the trapezoidal rule the same as finding the area of a trapezoid shape?

No. Finding the area of a single trapezoid shape uses ½ × (a + b) × h from its two parallel sides and height. The trapezoidal rule instead adds up many small trapezoids to approximate the area under a curve made of several data points, which is a numerical integration method, not a shape-area formula.

How accurate is the trapezoidal rule?

It is exact for straight-line data and close to exact for gently curving data with enough points. For curves that bow noticeably between points, it tends to slightly overestimate the area under a convex curve and slightly underestimate it under a concave one, an error that shrinks as more, closer-together points are used.

What if my x values are not evenly spaced?

That is fine. Each subinterval is treated on its own, using its own actual width, so unevenly spaced data points are handled correctly without any special adjustment.

What happens if I enter the same number of x and y values but out of order?

The x values must be entered in increasing order for the calculation to make sense, since each step relies on moving from a smaller x to the next larger one. Sort both lists into matching increasing-x order before entering them.

For the plain area of a trapezoid shape rather than the area under a curve, see the area of trapezium calculator. For a straight line's own equation rather than a curve made of points, see the gradient calculator.