The divergence theorem, also called Gauss's theorem, is a statement about net outflow. Picture a closed surface sitting in a field of arrows, such as a flowing fluid or an electric field. The theorem says that the total outward flux through that surface, how much is leaving less how much is entering, equals the sum of the local outflow at every point inside the solid the surface wraps around. Nothing about the surface's shape matters once that sum is set up correctly. This page states the theorem the way OpenStax Calculus Volume 3 states it, explains why it works, and checks two worked examples by exact arithmetic.
Flux in plain words
Flux through a surface is a single number that answers one question: of everything the field is carrying, how much net amount crosses this surface, counted outward as positive and inward as negative? If a surface is closed, meaning it fully encloses a solid with no gaps, flux measures net outflow from that solid. A positive flux means more is leaving than entering. A negative flux means the reverse. A flux of zero does not mean nothing crosses the surface. It means the outward and inward crossings balance.
This is the same picture as a vector field pushing fluid, electricity, or heat through space, a framing MIT OpenCourseWare's 18.02SC unit on flux and the divergence theorem opens with, and it sits beside the circulation picture on Stokes theorem intuition. Circulation adds up a field along a rim. Flux adds up a field across a surface. The divergence theorem is the closed surface version of flux, parallel to how Stokes theorem handles circulation on an open surface's boundary.
Divergence as outflow per unit volume
For a field $\mathbf{F}=\langle P,Q,R\rangle$, the divergence is the scalar $\operatorname{div}\mathbf{F}=P_x+Q_y+R_z$, the sum of the matching partial derivatives. At a single point, divergence measures the rate of outflow per unit volume there. A positive divergence marks a source, where more is flowing out of a tiny neighborhood than into it. A negative divergence marks a sink. Zero divergence means the local outflow and inflow balance exactly. The divergence and curl calculator estimates this number at a point with a central difference, and the gradient and directional derivative calculator estimates the individual partial derivatives that divergence is built from. Neither tool adds divergence over a solid. That addition is exactly what the theorem below supplies.
Statement of the divergence theorem
$$\iint_{S}\mathbf{F}\cdot d\mathbf{S}=\iiint_{E}\operatorname{div}\mathbf{F}\,dV.$$
Those conditions are not decoration. The surface must be piecewise smooth and closed, so a sphere, a cube's boundary, or a cylinder with both caps qualifies, but a hemisphere alone does not. The orientation must be outward: the normal at every point of $S$ points away from the solid it wraps. The field must have continuous partial derivatives on an open set that contains the whole solid, not merely on the surface itself, exactly as OpenStax Calculus Volume 3's statement of the theorem requires. The left side is the total flux leaving $S$. The right side sums the local outflow at every point of $E$. The theorem says those two numbers always agree once the hypotheses hold.
Why it works: tiny boxes
Slice the solid $E$ into many small boxes. Each interior box shares a face with a neighbor. The flux leaving one box through a shared face is exactly the flux entering the neighbor through that same face, because the two boxes see opposite normals on the identical patch of surface. Add the flux over every tiny box and every interior face cancels, leaving only the faces on the outer boundary $S$. That remaining sum is the flux through $S$. At the same time, the flux out of one tiny box, divided by its volume, is close to the divergence at a point inside it once the box is small, so the sum over all the tiny boxes approaches the triple integral of divergence over $E$. Both descriptions are counting the same total two ways, which is the theorem. This is the same cancellation that makes a telescoping sum collapse on a line, and the same pattern Stokes theorem uses on a surface, where interior edges cancel and only the outer rim survives.
Worked example 1: a radial field on the unit ball
Let $\mathbf{F}=\langle x,y,z\rangle$ and let $E$ be the unit ball $x^2+y^2+z^2\le 1$, with boundary $S$ the unit sphere. First the divergence: $\operatorname{div}\mathbf{F}=\dfrac{\partial x}{\partial x}+\dfrac{\partial y}{\partial y}+\dfrac{\partial z}{\partial z}=1+1+1=3$. The triple integral of a constant is that constant times the volume, and the unit ball has volume $\frac{4}{3}\pi$, so
$$\iiint_E \operatorname{div}\mathbf{F}\,dV = 3\cdot\frac{4}{3}\pi = 4\pi.$$
Worked example 2: squared components on a unit cube
Let $\mathbf{F}=\langle x^2,y^2,z^2\rangle$ and let $E$ be the unit cube $[0,1]^3$, with boundary $S$ its six faces. The divergence is $\operatorname{div}\mathbf{F}=2x+2y+2z$. By symmetry, each of the three terms integrates to the same value over the cube: $\displaystyle\int_0^1\!\!\int_0^1\!\!\int_0^1 2x\,dx\,dy\,dz = 2\cdot\frac{1}{2}=1$, and likewise for the $y$ and $z$ terms. Adding the three gives
$$\iiint_E \operatorname{div}\mathbf{F}\,dV = 1+1+1 = 3.$$
When to use the divergence theorem
Reach for the theorem when the surface is closed and the direct surface integral looks messy, such as a sphere, a box, or a cylinder with both end caps, where parametrizing every piece and computing each flux separately is slow. Paul's Online Math Notes' divergence theorem page works a closed surface built from a curved paraboloid cap, a cylindrical side, and a flat bottom this same way, in cylindrical coordinates. Converting to a triple integral of divergence, as in worked example 2 above, often turns six separate surface pieces into one solid integral. The theorem also runs the other way: a messy triple integral can sometimes become an easier flux computation, when the surface integral happens to be the simpler side.
An open surface, such as a bowl, a disk, or a single face of a cube with no other sides, has no enclosed solid on its own, so the theorem does not apply directly. Close the surface first by adding a cap across the open rim, apply the theorem to the now closed surface, then subtract the flux through the cap, computed directly, to recover the flux through the original open piece. This is the same move Stokes theorem's hemisphere and disk swap makes in reverse: there, two open surfaces share a rim and trade places; here, an open surface gains a cap to become closed.
Sources and sinks: a physical reading
If $\mathbf{F}$ is the velocity field of a fluid, divergence at a point reads as the rate per unit volume at which fluid is being created there, a source, or removed, a sink. A positive divergence throughout a region means fluid is appearing somewhere inside, and the theorem says the net outward flux through the boundary must match that total creation. An incompressible fluid with no sources or sinks has divergence zero everywhere, so the flux through every closed surface in it is zero: whatever enters a region also leaves it.
The same structure governs an electric field, where the divergence theorem underlies Gauss's law, a named application of the theorem to electrostatics that relates flux through a closed surface to the charge enclosed. OpenStax Calculus Volume 3 works through that connection as one of the theorem's standard uses. This page does not restate Gauss's law's constants or numbers, since that belongs to a physics course and not a mathematics theorem explainer.
Common mistakes
- Using an inward normal. The theorem requires the outward normal. Flip it and every flux number flips sign, which can make a positive source look like a sink.
- Applying the theorem to an open surface. A disk, a bowl, or a single face has no enclosed solid. Close it with a cap first, or compute the open surface's flux directly.
- Forgetting a face when a solid has several pieces of boundary. A cylinder needs both flat caps and the curved side. A box needs all six faces. Leaving one out breaks the match between the two sides of the theorem.
- Treating a local divergence number as a flux. Divergence at one point is a rate per unit volume. Flux is a total over a whole surface. The theorem is the bridge between them, not a shortcut that skips the integral.
Practice with the calculators
The vector operations calculator checks a single dot product, such as $\mathbf{F}\cdot\mathbf{n}$ at one point in either worked example above, once you have written both vectors by hand. It does not sum that dot product over a whole surface. The divergence and curl calculator estimates divergence at a point with a central difference and reports the number. For worked example 1, computing divergence at a sample point such as $(1,0,0)$ should read close to $3$, matching the exact value $\operatorname{div}\mathbf{F}=3$ used above. Predict the number from the formula first, then compare.
Write the divergence by hand, then check one partial derivative or one dot product before trusting a browser estimate.
Open the divergence and curl calculatorWhere this fits
This explainer sits in the multivariable and vector calculus cluster, after Jacobian matrices in plain language and Lagrange multipliers intuition, alongside Stokes theorem intuition. The wider map is multivariable and vector calculus, which places divergence, curl, and the two closed form theorems next to the scalar side of the pillar: gradients, Jacobians, and constrained optimization.
Sources and further reading
- OpenStax, Calculus Volume 3, 6.8 The Divergence Theorem (statement, hypotheses, and the electrostatic application). openstax.org (accessed 17 Nov 2026)
- Paul's Online Math Notes, Calculus III, Divergence Theorem (the theorem statement and a worked flux example). tutorial.math.lamar.edu (accessed 17 Nov 2026)
- MIT OpenCourseWare, 18.02SC Multivariable Calculus, Part B: Flux and the Divergence Theorem. ocw.mit.edu (accessed 17 Nov 2026)
Last reviewed: 17 November 2026.
Common questions
What does the divergence theorem equate?
It equates the outward flux of a vector field through a closed surface with the triple integral of the divergence of that field over the solid the surface encloses. The surface must be piecewise smooth and closed, the field must have continuous partial derivatives on an open region containing the solid, and the normal on the surface points outward.
What is the difference between divergence and flux?
Divergence is a local number at one point: the outflow per unit volume there, built from partial derivatives. Flux is a total over a whole surface: the sum of the field crossing that surface in the outward direction. The divergence theorem is the bridge, turning the sum of local outflow over a solid into the flux crossing its boundary.
Why does an open surface need a closing cap before the theorem applies?
The divergence theorem only relates a closed surface to the solid it encloses. An open surface, such as a bowl with no lid, has no enclosed solid on its own. Add a cap across the rim to make the surface closed, apply the theorem to the capped surface, then subtract the flux through the cap, which you compute directly, to recover the flux through the original open surface.
Which calculator should I use with this page?
The divergence and curl calculator estimates divergence at a point with a central difference, which is a local check, not a flux. The vector operations calculator checks a single dot product, such as the field dotted with a normal vector in the worked examples. Neither tool integrates a surface or a solid for you.
Related reading
- Stokes theorem intuition and Jacobian matrices in plain language
- Lagrange multipliers intuition
- Multivariable and vector calculus topic map
- Glossary: divergence, curl, vector field, all explainers and the sources page
Related tools
The divergence and curl calculator estimates divergence and curl at a point with an arrow plot. The gradient and directional derivative calculator estimates the partial derivatives that build divergence. The vector operations calculator checks a single dot product in either worked example.