Integral Calculator (Definite and Indefinite)

Quick answer

The integral calculator finds the antiderivative of a function of x when a standard rule applies and computes definite integrals numerically with adaptive Simpson’s rule, including limits such as pi/2 or infinity.

Antiderivative ∫f(x) dx
x^3 + sin(2x) + C
Definite integral from a to b
3.875784585
Method
f(x) = 3x^2 + 2cos(2x) Antiderivative: power rule: ∫xⁿ dx = xⁿ⁺¹/(n + 1); linear substitution u = 2x (divide by 2); ∫cos u du = sin u; constant multiple rule; sum rule: integrate term by term. Check: differentiating F(x) gives back f(x) at every test point. Definite integral from 0 to π/2 ≈ 1.570796327 by adaptive Simpson’s rule, target accuracy about 10⁻¹⁰. Cross-check: F(b) − F(a) = 3.875784585 − 0 = 3.875784585.

Integration runs differentiation backwards. The indefinite integral, or antiderivative, is a function F whose derivative is f, plus a constant C because constants vanish when you differentiate. The definite integral from a to b is a single number: the signed area between the curve and the x-axis over that interval. Type a function of x to get its antiderivative, and add lower and upper limits to get the definite value as well.

How to use the Integral Calculator

  1. Type the function with x as the variable, for example 3x^2 + 2cos(2x), x e^x or 1/(1 + x^2). A leading ∫ and a trailing dx are ignored, so you can paste an integral as it is written.
  2. For a definite integral, enter the lower limit a and the upper limit b. Numbers, pi/2, sqrt(2) and inf for infinity all work.
  3. Leave both limits empty if you only need the antiderivative.
  4. Read the method box to see which rule produced the formula and how the number was found.

Everything is calculated in your browser, so results appear instantly and nothing you type is sent to a server.

How it works

For the antiderivative the calculator tries a set of standard rules: the power rule for polynomials and powers of x, linearity for sums and constant multiples, a table of standard integrals for exponentials, logarithms, trig functions, 1/(1 + x²) and 1/√(1 − x²), a linear substitution when the inside is ax + b, a u-substitution when the derivative of the inside appears as a factor, and integration by parts for a polynomial times eˣ, sin, cos or ln x. Before anything is shown, the answer is differentiated and compared with your function at several points, so a formula only appears if it checks out. The definite integral is always computed numerically with adaptive Simpson’s rule. The interval is split into panels, each panel is refined until two estimates agree to about 10⁻¹⁰, and infinite limits are first mapped onto a finite range. When a formula exists, the calculator also shows F(b) − F(a) as a cross-check.

Worked example: ∫ from 0 to π/2 of (3x² + 2cos(2x)) dx

  1. Integrate term by term. The power rule turns 3x² into 3 × x³/3 = x³.
  2. For 2cos(2x), the linear substitution u = 2x gives ∫cos u du = sin u, divided by 2 for the inside, so 2 × sin(2x)/2 = sin(2x).
  3. So F(x) = x³ + sin(2x) + C.
  4. Evaluate at the limits: F(π/2) = (π/2)³ + sin(π) = 3.875784585 + 0, and F(0) = 0 + sin(0) = 0.
  5. The definite integral is 3.875784585. Adaptive Simpson’s rule gives the same value to all ten digits shown.

Common antiderivatives

f(x) ∫f(x) dx Condition
xⁿ xⁿ⁺¹/(n + 1) + C n ≠ −1
1/x ln|x| + C x ≠ 0
eᵃˣ eᵃˣ/a + C a ≠ 0
aˣ aˣ/ln a + C a > 0, a ≠ 1
sin(ax) −cos(ax)/a + C a ≠ 0
cos(ax) sin(ax)/a + C a ≠ 0
sec² x tan x + C cos x ≠ 0
tan x −ln|cos x| + C cos x ≠ 0
1/(1 + x²) atan x + C all x
1/√(1 − x²) asin x + C −1 < x < 1
ln x x·ln x − x + C x > 0

When no formula is shown

Many ordinary looking functions have no antiderivative made of elementary functions. The classic example is e^(x²), whose integral leads to the error function, and sin(x)/x, which leads to the sine integral. For these the calculator says plainly that no closed form is shown and still gives the definite value. For instance, the integral of e^(x²) from 0 to 1 is 1.462651746. Other functions do have a formula that the built-in rules do not reach, such as x·sin²(x). There too you still get an accurate definite value.

Infinite limits and warnings

You can type inf or −inf as a limit. The integral of e^(−x) from 0 to inf is 1, and the integral of e^(−x²) from −inf to inf is √π ≈ 1.772453851. If the function blows up inside the interval, as 1/x does at 0 on [−1, 1], or the area grows without bound, as for 1/x on [1, inf), the calculator tells you so instead of printing a misleading number. Integrals that only converge because positive and negative parts cancel slowly, such as sin(x)/x out to infinity, are beyond what the numerical method can settle, and they are reported as not converging.

Formula

∫xⁿ dx = xⁿ⁺¹/(n + 1) + C (n ≠ −1), ∫1/x dx = ln|x| + C ∫eᵃˣ dx = eᵃˣ/a + C, ∫sin(ax) dx = −cos(ax)/a + C, ∫cos(ax) dx = sin(ax)/a + C ∫ from a to b of f(x) dx = F(b) − F(a)

Worked example

Inputs: Function f(x): 3x^2 + 2cos(2x); Lower limit a: 0; Upper limit b: pi/2.
Results: Antiderivative ∫f(x) dx = x^3 + sin(2x) + C; Definite integral from a to b = 3.875784585.

Key terms

Antiderivative
A function F whose derivative is f, also called the indefinite integral.
Definite integral
The signed area under y = f(x) between x = a and x = b.
Constant of integration
The + C added to an antiderivative.
u-substitution
Replacing an inside expression u = g(x) when g′(x) also appears in the integrand. It reverses the chain rule.
Adaptive Simpson’s rule
A numerical method that fits parabolas to small pieces of the curve and splits a piece further wherever the estimate is not yet accurate.
Improper integral
An integral with an infinite limit, or with an integrand that becomes infinite in the interval.

Frequently asked questions

Why is there a + C?

Every function has many antiderivatives that differ by a constant, because the derivative of a constant is zero. C stands for that unknown constant.

What does a negative definite integral mean?

Area below the x-axis counts as negative. The integral of sin(x) from 0 to 2π is 0 because the area above the axis and the area below it cancel.

How accurate is the definite value?

Adaptive Simpson’s rule aims for an error below about 10⁻¹⁰, and the value is shown to 10 significant digits. When f is infinite at an end of the interval, it is shown to 8 digits.

Can I swap the limits?

Yes. Swapping a and b changes the sign of the definite integral, and the calculator handles that for you.

Why does ln

x| have absolute value bars? | The derivative of ln|x| is 1/x for positive and negative x alike, so the bars make the antiderivative of 1/x valid on either side of zero.

Does it use radians?

Yes. Trig functions take x in radians, as every calculus formula assumes.

Sources

  1. OpenStax: Calculus Volume 1
  2. OpenStax: Calculus Volume 2
  3. NIST Digital Library of Mathematical Functions

Cite this calculator

Speedy Calculator. (2026). Integral Calculator (Definite and Indefinite). Speedy Calculator. https://speedycalculator.com/calculators/math/integral/

Embed this calculator on your website

Free for blogs, schools and businesses. Paste this code where the calculator should appear; it stays up to date automatically.