Integral Calculator

Type a function of x (like x^2 + sin(x)), set a lower and upper bound (plain numbers or pi, 2pi, pi/2, e), and get the definite integral, computed numerically with Simpson's rule.

Put this calculator on your website for free

Copy one snippet and give your visitors a working Integral Calculator.

How this integral calculator works

This is a definite integral calculator: it returns one number, the signed area between your curve and the x-axis from a to b. It never finds an antiderivative. Instead it evaluates f(x) at 1,001 evenly spaced points and combines them with composite Simpson's rule, which is why it can integrate functions that have no closed-form antiderivative at all (try e^(-x^2) from 0 to 1). The honest trade-off: if you need the indefinite integral (the symbolic antiderivative, with steps), that takes a computer algebra system, not a numerical method. No calculator that works this way can show algebra steps, because there aren't any.

Supported syntax: numbers, x, the operators + - * / ^, parentheses, the functions sin cos tan asin acos atan sqrt abs ln log exp (log is base 10, ln is natural), and the constants pi and e. Multiplication must be explicit: 2*x, not 2x.

The formula

ab f(x) dx  ≈  (h⁄3) [ f(x0) + 4f(x1) + 2f(x2) + 4f(x3) + ... + 4f(xn−1) + f(xn) ],   h = (b − a)⁄n

Here n is the number of subintervals (we use 1,000), h is the width of each one, and x0 ... xn are the sample points from a to b. The friendly version: Simpson's rule slices your interval into narrow strips, and instead of approximating the curve in each strip with a flat top (rectangles) or a slanted top (trapezoids), it fits a small parabola through each set of three neighboring points. Parabolas hug curves so well that the error shrinks with the fourth power of the strip width: halve the strips and the error drops roughly 16-fold. That's why 1,000 strips is comfortable overkill for anything smooth.

Worked example

01 x² dx: the antiderivative is x³/3, so the exact answer is 1/3. The calculator returns 0.333333, matching to every displayed digit (Simpson's rule is actually exact for polynomials up to degree 3).

0π sin(x) dx: the antiderivative is −cos(x), so the exact answer is −cos(π) − (−cos(0)) = 1 + 1 = 2. Enter sin(x) with bounds 0 and pi and you'll get 2.000000.

Common antiderivatives worth memorizing

For hand integration (and for checking this calculator against exact answers), these five cover a remarkable share of homework:

f(x)∫ f(x) dxWatch out for
xn (n ≠ −1)xn+1⁄(n+1) + CFails at n = −1; that case is the next row
1⁄xln|x| + CThe absolute value matters for x < 0
exex + CIts own antiderivative; enjoy it
sin(x)−cos(x) + CThe minus sign, every single time
cos(x)sin(x) + CNo minus sign here; sin/cos are asymmetric

When numerical integration lies (and how we avoid it)

Numerical methods fail loudly in one case and quietly in another. The loud case is a singularity: integrate 1/x from −1 to 1 and a sample point lands on the vertical asymptote at 0. Some calculators average their way to a plausible-looking garbage number; this one checks every sample for infinities and domain errors (sqrt of a negative, asin beyond ±1) and tells you the integral is improper instead. The quiet case is undersampling: a function oscillating thousands of times between your bounds can wiggle right between the sample points. With 1,000 subintervals you're safe up to a few hundred oscillations; past that, split the interval and integrate the pieces.

Frequently asked questions

Why doesn't this integral calculator show steps?

Honest answer: because it never finds an antiderivative. It computes the definite integral numerically (sampling your function 1,001 times and combining the values with Simpson's rule), so there are no algebra steps to display. If you need the symbolic antiderivative with worked steps, you want a computer algebra system (CAS) like WolframAlpha or SymPy; for hand integration, start with the antiderivative table on this page.

What functions and syntax can I type into the calculator?

Numbers, the variable x, the operators + - * / ^ (with parentheses), the functions sin, cos, tan, asin, acos, atan, sqrt, abs, ln, log (base 10), and exp, plus the constants pi and e. Write multiplication explicitly (2*x, not 2x) and give every function parentheses: sin(x), not sin x.

What is the difference between a definite and an indefinite integral?

An indefinite integral is a family of functions: the antiderivative plus a constant C. A definite integral is a single number: the signed area between the curve and the x-axis from a to b. This calculator computes the number. Area below the axis counts as negative, which is why sin(x) from 0 to 2pi comes out to zero.

Why do I get a singularity warning instead of an answer?

Your function blows up or leaves its domain somewhere between the bounds: think 1/x across 0, ln(x) at 0, or sqrt(x) on negative inputs. Numerical integration needs a finite value at every sample point, so instead of returning a confidently wrong number, the calculator tells you the integral is improper there. Try splitting the interval or nudging a bound past the trouble spot.

How accurate is Simpson's rule with 1,000 subintervals?

For smooth functions, absurdly accurate: the error shrinks with the fourth power of the step size, so typical textbook integrals are correct to 10+ decimal places, far beyond the six we display. Accuracy degrades for wildly oscillating functions (like sin(1000*x)) or curves with sharp corners, where the samples can miss the action between points.

Related calculators