Integral Calculator
This calculator approximates a definite integral numerically: type f(x), the two limits and the number of subintervals, and it returns the area under the curve to about ten significant digits, with an error estimate for Simpson's rule. It does not find antiderivatives or symbolic answers, so it will not turn x^2 into x^3/3 for you; it only produces a number for a finite interval.
Last updated November 4, 2026
Use x, + - * / ^, brackets, sqrt, ln, sin, cos, e^x. Write 2*x, not 2x. Trig is in radians.
A number, or pi / e such as 2*pi.
Finite only; infinite limits are not supported.
Whole number from 2 to 100,000; even for Simpson.
Result
≈ 2
Estimated error about 6.8e-14 (heuristic: assumes a smooth function). It is an estimate, not a bound.
Numerical approximation, not an exact antiderivative. Trig in radians.
| Subintervals | Approximation |
|---|---|
| 1000 | 2 |
| 2000 | 2 |
| 4000 | 2 |
Show the work
Formula: Simpson's rule on n and on 2n subintervals; value = S(2n), error ≈ |S(2n) - S(n)| / 15. Trig functions use radians.
- Function f(x) = sin(x); limits a = 0 and b = 3.141592654; n = 1000 subintervals.
- Run Simpson's rule twice: on n = 1000 (S(n) = 2) and on 2n = 2000 subintervals, the finer one being reported.
- Step size h = (b - a) / 2000 = (3.141592654 - 0) / 2000 = 0.001570796327.
- End values: f(a) = 0, f(b) = 0. Sum at odd points: 636.6200342; sum at even interior points: 636.6192488.
- Bracket = (0 + 0 + 4×636.6200342 + 2×636.6192488) / 3 = 1273.239545.
- Integral ≈ h × bracket = 0.001570796327 × 1273.239545 = 2.
- Error estimate (heuristic: assumes a smooth function) = |S(2n) - S(n)| / 15 = |2 - 2| / 15 = 6.8e-14.
Result: Integral of sin(x) from 0 to 3.141592654 ≈ 2 (numerical approximation)
The numerical rules used
h = (b - a) / n, x_i = a + i × h
The interval from a to b is cut into n equal subintervals of width h, and the curve is replaced on each piece by something simple. Four choices are offered. The trapezoid rule joins neighboring points with straight lines: h × [ (f(a) + f(b)) / 2 + the sum of f(x_i) for i = 1 to n-1 ]. The midpoint rule takes one rectangle per subinterval, with its height measured in the middle: h × the sum of f(a + (i + 1/2) × h).
Simpson's 1/3 rule fits a parabola through each pair of subintervals: (h / 3) × [ f(a) + f(b) + 4 × the sum at odd points + 2 × the sum at even interior points ]. It needs an even n, and it is exact for polynomials up to degree three. The fourth option, Simpson with error estimate, runs the rule on n and on 2n subintervals, reports the finer result and estimates its error as |S(2n) - S(n)| / 15, because halving h shrinks Simpson's error by about a factor of sixteen for smooth functions. It is a heuristic, adjusted when convergence is slower.
If a is greater than b the result is the negative of the integral from b to a, and if a equals b the answer is 0. The sums are added with compensated (Kahan-style) summation so rounding does not pile up over many terms. Trigonometric functions work in radians, and the constants pi and e are understood, so the exponential function is written e^x.
See how we calculate for the formulas, sources and review schedule behind every calculator.
Also useful alongside this calculator: Scientific Calculator and Basic Calculator.
How to write f(x)
Use a lowercase x as the variable, with + - * / ^, brackets, sqrt, cbrt, abs, ln, log, sin, cos, tan, asin, acos and atan. Multiplication must be explicit: write 2*x, not 2x, and x*(x+1), not x(x+1).
The limits can be plain numbers or short expressions such as pi, pi/2 or 2*e. Infinite limits are not supported, because the rules need a finite interval, so improper integrals such as the area under 1/x^2 from 1 to infinity are out of scope.
When the function breaks
The function is checked at both limits and at the midpoint before the sums start, and again at every sample point. If it divides by zero, takes the logarithm of a non-positive number, takes the square root of a negative number or hits a point where tan is undefined, the calculator stops and names the x value where it failed. That usually signals an improper or divergent integral, such as 1/x across 0.
Smooth functions converge quickly, but a sharp corner or fast wiggle needs a larger n. Compare the n, 2n and 4n rows of the table: if the digits keep changing, increase n. A result that should be zero may show a leftover such as 1e-16, which is rounding noise.
Accuracy drops near a sharp point at a limit such as sqrt(x) at 0: Simpson with n = 1000 gives 0.666664 for an exact 2/3, and doubling n helps only slowly.
How to use the Integral Calculator
- Type f(x) using x as the variable, for example sin(x) or 4/(1+x^2).
- Enter the lower limit a and the upper limit b; numbers, pi and e are accepted.
- Set the number of subintervals n (default 1000; use an even number for Simpson) and pick a method.
- Read the approximation, the error estimate and the n, 2n, 4n table in the result.
- Open Show the work to see h, the sums and the final multiplication with your own numbers.
Worked example: sin(x) from 0 to pi with n = 10
The exact area under one arch of sine is 2, found by hand from the antiderivative -cos(x). With only ten subintervals the rules already come close, and each one gets better as n doubles. The table shows the approximation for n = 10, 20 and 40; Simpson's rule is far closer than the other two.
| Rule | n = 10 | n = 20 | n = 40 |
|---|---|---|---|
| Trapezoid | 1.983523538 | 1.995885973 | 1.99897181 |
| Midpoint | 2.008248408 | 2.002057648 | 2.000514134 |
| Simpson 1/3 | 2.000109517 | 2.000006784 | 2.000000423 |
Frequently asked questions
Does this calculator find antiderivatives or symbolic answers?
No. It is a numerical calculator: it gives a decimal approximation of a definite integral between two finite limits and never an exact formula or antiderivative.
Which method should I choose?
Simpson with error estimate is the best default for smooth functions. Trapezoid and midpoint help compare.
Why does it say my function failed at some x value?
At that x the function could not be computed, for example by dividing by zero or taking the logarithm of zero. The integral may be improper or divergent, which this calculator does not handle.
How accurate is the answer?
Accuracy depends on n and on how smooth f is. Simpson with error estimate shows an estimated error; for the other rules, watch how the n, 2n and 4n rows converge.
Can I integrate to infinity or use degrees?
No to both. Limits must be finite numbers, so improper integrals are rejected, and the trigonometric functions always work in radians. Use pi to write angle limits.