Integral Calculator
Compute definite integrals numerically and see the signed area under the curve
Function to integrate
Definite integral
Enter a function and the limits a and b, then tap Integrate to see the value and the shaded area under the curve.
About this tool
This integral calculator evaluates definite integrals numerically, entirely in your browser. It parses your function into an expression tree with a safe parser (no eval), samples it across the interval [a, b], and approximates the area under the curve using the composite Simpson's rule, with the composite trapezoid rule shown alongside for comparison. The result is the signed area: regions above the x-axis count as positive and regions below as negative, and the visualization color-codes them so you can see exactly what the number means. You can integrate with respect to x or any variable, use constants such as pi and e in the function and the limits, and reverse the limits (which flips the sign). Because it is numerical, the answer is a very accurate approximation rather than a closed-form antiderivative — pair it with the derivative calculator for symbolic work.
How to use
- 1 Type the function to integrate, for example x^2, sin(x) or 1/x.
- 2 Set the variable (x by default) and enter the lower limit a and upper limit b. You can use pi or e.
- 3 Tap Integrate to get the value of the definite integral, computed with Simpson's rule.
- 4 Read the Simpson vs trapezoid comparison for confidence, and study the shaded area below the curve.
How it works
The calculator parses your expression into an abstract syntax tree, then approximates ∫f(x)dx over [a, b] by dividing the interval into many small subintervals (1000 by default) and adding up the contributions. Composite Simpson's rule fits a parabola through each pair of subintervals, giving fourth-order accuracy for smooth functions, while the trapezoid rule connects the sample points with straight lines. The closeness of the two values (shown as the convergence figure) tells you how trustworthy the estimate is — for smooth functions they agree to many digits. The signed area is computed honestly: parts of the curve below the x-axis subtract from the total. Endpoints that evaluate to infinity are nudged slightly inward, and if the function is singular inside the interval the tool reports that the integral is undefined instead of returning a misleading finite number.
Frequently asked questions
Is the result exact or an approximation?
It is a numerical approximation. The tool samples the function at many points and adds up the area, rather than finding a symbolic antiderivative. For smooth functions the result is accurate to many decimal places — typically far better than you would get by hand — but it is still an estimate, not a closed-form expression.
What is the difference between Simpson's rule and the trapezoid rule?
The trapezoid rule joins consecutive sample points with straight lines and sums the trapezoids, which is simple but less accurate. Simpson's rule fits parabolas through pairs of subintervals, capturing curvature and converging much faster (fourth-order). We show both so you can see them agree; the gap between them is a handy convergence check.
How does it handle singularities or divergent integrals?
If the function blows up at an endpoint, the tool evaluates just inside the interval to cope with removable cases. But if the function is undefined or infinite within the interval — such as 1/x integrated across 0 — it reports that the integral is undefined rather than returning a false finite value. Integrals that grow without bound are flagged as diverging.
Is this a definite or an indefinite integral?
This computes the definite integral — a single number equal to the signed area between the curve and the x-axis from a to b. It does not produce an indefinite integral (the symbolic antiderivative with +C). For symbolic calculus, use the derivative calculator; numeric definite integration is what this tool specialises in.
Can I use pi, e, or limits in reverse order?
Yes. You can write pi and e in both the function and the limits (for example integrate sin(x) from 0 to pi). If the lower limit is larger than the upper limit, the integral is computed with the sign reversed, exactly matching the convention ∫a→b = −∫b→a.
Related tools and uses
Definite integrals measure accumulated quantities: area, distance from velocity, work, probability and more. Pair this with the derivative calculator to see differentiation and integration as inverse operations, the graphing calculator to view the curve whose area you are measuring, and the scientific calculator for evaluating the numbers that come out.