Integral in LaTeX
Type \int in math mode and add the limits as a subscript and superscript: \int_{a}^{b} f(x) \, dx. _ sets the lower limit, ^ the upper one, and \, puts the small space that belongs before dx. Double and triple integrals are \iint and \iiint from amsmath.
Integral commands
\int f(x) \, dxIndefinite integral.
\int_{a}^{b} f(x) \, dxDefinite integral with lower limit a and upper limit b.
\iint_{D} f \, dADouble integral (amsmath), region written as a subscript.
\iiint_{V} f \, dVTriple integral (amsmath).
\idotsintMultiple integral with dots between the signs (amsmath).
\oint_{C} \mathbf{F} \cdot d\mathbf{r}Contour (closed path) integral.
- Text mode, no math preview
\oiint_{S}Closed surface integral; needs the
esintpackage in LaTeX and is not available in MathJax. \int\limits_{a}^{b}Puts the limits above and below the sign instead of beside it.
Try it live
Change the formula and the preview redraws as you type. Copy the LaTeX, download a PNG or SVG, copy it for Word, or use Edit here on any example below to load it.
Integral examples
Each result below is drawn from the LaTeX under it. Copy the code, edit it on this page, or open it in the full editor.
Definite integral
LaTeX\int_{0}^{1} x^2 \, dx = \frac{1}{3}Indefinite integral
LaTeX\int \cos x \, dx = \sin x + CEvaluation bar
LaTeX\int_{1}^{e} \frac{1}{x} \, dx = \Big[ \ln x \Big]_{1}^{e} = 1\Big[ … \Big]or\left. … \right|_{a}^{b}draws the bracket or bar with the limits on it.Double integral over a region
LaTeX\iint_{D} (x + y) \, dx \, dyTriple integral
LaTeX\iiint_{V} \rho(x, y, z) \, dVLine integral
LaTeX\oint_{C} \mathbf{F} \cdot d\mathbf{r} = \iint_{S} (\nabla \times \mathbf{F}) \cdot d\mathbf{S}Upright differential
LaTeX\int_{-\infty}^{\infty} e^{-x^2} \, \mathrm{d}x = \sqrt{\pi}Some journals want the d upright (ISO style);
\mathrm{d}xdoes that.Limits above and below
LaTeX\int\limits_{0}^{2\pi} \sin^2 \theta \, d\theta = \pi
How to write an integral step by step
Start with \int inside math mode ($ … $ inline or \[ … \] displayed). Add _{…} for the lower limit and ^{…} for the upper limit. Braces are only optional for a single character, so \int_0^1 works but \int_0^{10} needs them.
Write the integrand, then a thin space \, and the differential: f(x) \, dx. Without the space LaTeX sets f(x)dx tightly, which reads like a product.
In displayed equations the integral sign is taller, but the limits stay to its right. That is the normal LaTeX style for integrals; add \limits only if your style guide wants them above and below.
\documentclass{article}
\usepackage{amsmath}
\begin{document}
The area is $\int_0^1 x^2 \, dx = \tfrac{1}{3}$, or displayed:
\[
\int_{0}^{1} x^2 \, dx = \frac{1}{3}
\]
\end{document}Multiple and closed integrals
\iint, \iiint, \iiiint and \idotsint come from amsmath and space the signs correctly. Typing \int\int instead leaves a gap that looks wrong.
\oint (a single closed path) is built into LaTeX. Closed surface and volume integrals such as \oiint need the esint package in LaTeX; MathJax and KaTeX do not provide them, so on the web you usually write \oint with a subscript such as S.
Common mistakes
Without braces only the first character is the limit, so the upper limit becomes 1 and the 0 lands in the integrand.
Instead of\int_0^10 x \, dxWrite\int_0^{10} x \, dxThe thin space
\,separates the differential from the integrand, as in printed books.Instead of\int f(x)dxWrite\int f(x) \, dxTwo
\intin a row are spaced too far apart;\iintjoins them properly and takes one subscript.Instead of\int \int_D f \, dAWrite\iint_D f \, dA\oiintexists only with the esint package in LaTeX. Web renderers show it as an unknown command.Instead of\oiint_S \mathbf{F} \cdot d\mathbf{S} (in MathJax)Write\oint_S \mathbf{F} \cdot d\mathbf{S}
In Overleaf, MathJax and Word
Overleaf and pdfLaTeX
\intand\ointwork in any document;\iint,\iiintand\idotsintneed\usepackage{amsmath}, and\oiintneeds\usepackage{esint}.MathJax and KaTeX
MathJax and KaTeX render
\int,\iint,\iiint,\ointand\limitswithout setup.\oiintfrom esint is not available, so write it another way on web pages and in Markdown notes.Microsoft Word
Word has its own integral templates, but pasted LaTeX is not converted reliably. Write the integral in the editor here and press Copy for Word to paste an editable Word equation with the limits in place.
Integral in LaTeX: questions
- How do I write an integral with limits in LaTeX?
- Put the lower limit after
_and the upper after^:\int_{a}^{b} f(x) \, dx. Use braces whenever a limit has more than one character. - How do I write a double integral?
- Use
\iintfrom amsmath, for example\iint_{D} f(x, y) \, dx \, dy. Triple integrals use\iiint. - Why are the integral limits beside the sign and not above it?
- That is the default for integrals in LaTeX, even in displayed equations. Write
\int\limits_{a}^{b}to put them above and below, or load amsmath with theintlimitsoption to change it for the whole document. - Should the d in dx be upright?
- Both styles are used. ISO and many physics journals use an upright d, written
\mathrm{d}x; most math texts use the italicdx. Pick one and keep it consistent.
Related LaTeX reference
- Summation in LaTeX\sum with limits, why inline sums put the limits beside the sigma, \limits and \displaystyle, and multi-line conditions with \substack.
- Limit in LaTeX\lim_{x \to a}, one-sided limits, limits at infinity, limsup and liminf, and how to keep the condition under lim in running text.
- Infinity in LaTeXThe ∞ symbol with \infty: negative infinity, intervals, limits to infinity, infinite sums and integrals.
- LaTeX equation editorSymbol panel, live preview, and PNG, SVG, MathML or Word export.
- All LaTeX reference pagesSymbols, math structures and text formatting in one list.
Have the formula as a picture?
Paste a screenshot or photo of the equation and get its LaTeX, ready to copy or open in the editor.
Convert an image to LaTeX