In short

The electric flux through a surface measures how much electric field threads through that surface. For a flat surface of area A sitting in a uniform field \vec{E}, the flux is

\boxed{\;\Phi_E \;=\; \vec{E}\cdot\vec{A} \;=\; E\,A\,\cos\theta\;}

where \vec{A} = A\hat{n} is the area vector — a vector whose magnitude equals the surface area and whose direction is the chosen normal \hat{n} to the surface. The angle \theta is the angle between \vec{E} and \hat{n}.

For a non-uniform field or a curved surface, divide the surface into tiny patches \mathrm{d}\vec{A} = \hat{n}\,\mathrm{d}A and integrate:

\Phi_E \;=\; \int_S \vec{E}\cdot\mathrm{d}\vec{A}.

For a closed surface (one that encloses a volume, like a balloon), the convention is to take \hat{n} as the outward normal; the flux integral is written with a circle through the integral sign:

\Phi_E \;=\; \oint_S \vec{E}\cdot\mathrm{d}\vec{A}.

Positive flux means net field lines exit the surface; negative means they enter. Flux has SI units of \text{V}\cdot\text{m} or equivalently \text{N}\cdot\text{m}^2/\text{C}.

Physically, flux is a count of field lines piercing the surface. It is the bookkeeping that makes Gauss's law possible — the next article turns flux into a sharp statement about enclosed charge.

Stand under the overhang of a Mumbai building during a July downpour. Hold a rectangular cardboard frame — say, a piece cut from a cereal box — flat against the sky, parallel to the ground. Rain pours straight down through it. Now tilt the frame so it is vertical, edge-on to the falling rain. Barely a drop passes through; the rain slides by, missing the opening. Tilt it to 45^\circ, and the rate is somewhere in between — you can almost feel it is the "cosine" of the tilt angle.

The quantity that captures how much rain is passing through the frame per second has a name in electromagnetism: flux. Replace the rain with the electric field and the frame with a mathematical surface — any surface, flat or curved, open or closed, real or imagined — and the electric analogue of that "rate of piercing" is electric flux. The field does not really "flow" in the way water does, but the geometry of how much field is threading through the surface is identical, and the arithmetic is the same.

This article does four jobs. First, it builds the intuition from uniform fields and flat surfaces, where \Phi = EA\cos\theta suffices. Second, it introduces the area vector — the gadget that encodes orientation and magnitude in one compact object, so that the cosine is no longer tacked on separately but falls out of a dot product. Third, it extends to non-uniform fields and curved surfaces by an integration argument that parallels the one in the superposition article. Fourth, it handles closed surfaces, fixes the outward-normal convention, and shows how to compute the flux of a point-charge field through a cube and through a sphere — two examples whose answer (q/\varepsilon_0) will be promoted, in the next article, from a calculated fact to a universal law: Gauss's law.

You cannot study Gauss's law without flux. Gauss's law is a statement about flux. This article is the grammar for the sentence.

1. Uniform field, flat surface: the rain analogy in physics

The simplest case

Start with a uniform electric field \vec{E} — think of the field between two parallel charged plates, or of the near-field of a very large charged sheet — and a small flat surface of area A. Tilt the surface until its normal \hat{n} makes angle \theta with \vec{E}.

Three cases are clear before any algebra:

This is exactly the rain analogy. The rate of rain through a tilted window depends on the projected area of the window perpendicular to the rain's motion, which is A\cos\theta when the window normal is at angle \theta to vertical.

Three orientations of a flat surface in a uniform fieldThree panels showing a rectangle in a uniform horizontal electric field. Left panel: rectangle perpendicular to the field (theta equals 0), every field line passes through, flux is maximum. Middle panel: rectangle at 45 degrees, fewer field lines pass through. Right panel: rectangle parallel to the field (theta equals 90 degrees), no field lines pass through, flux is zero.θ = 0°: Φ = EAθ = 45°: Φ = EA cos 45°θθ = 90°: Φ = 0
Three orientations of a flat surface in the same uniform field. Flux is maximum when the surface normal aligns with the field, falls off as $\cos\theta$, and vanishes when the surface is parallel to the field.

The area vector

The cosine is just a dot product in disguise. Define the area vector of a flat surface to be

\vec{A} \;=\; A\,\hat{n},

where A is the area and \hat{n} is a unit vector normal to the surface. (If the surface is flat, there are two choices of \hat{n} differing by a minus sign; you pick one and stick with it for the rest of the calculation.) Then the flux is simply

\boxed{\;\Phi_E \;=\; \vec{E}\cdot\vec{A} \;=\; E\,A\,\cos\theta.\;} \tag{1}

Why: the dot product \vec{E}\cdot\vec{A} automatically produces |\vec{E}|\,|\vec{A}|\cos\theta = EA\cos\theta. Using the area vector bundles the magnitude and the orientation together, so you never have to think about the \cos\theta separately — the formula has the same form whether the surface is aligned with the field or tilted to 83^\circ.

Worked numerical sanity check. A field of \vec{E} = 500\,\hat{i} N/C passes through a square plate of side 0.20 m whose normal is tilted so that \hat{n} = \cos 60^\circ\,\hat{i} + \sin 60^\circ\,\hat{j}. Area A = 0.04 m². Flux:

\Phi = \vec{E}\cdot\vec{A} = 500\cdot 0.04 \cdot \cos 60^\circ = 500\cdot 0.04\cdot 0.5 = 10\,\text{N}\cdot\text{m}^2/\text{C}.

The units \text{N}\cdot\text{m}^2/\text{C} are the canonical SI units for electric flux. They are equivalent to \text{V}\cdot\text{m}, since 1\text{ V} = 1\text{ N}\cdot\text{m}/\text{C}; that equivalence will be useful once you meet electric potential.

Why "field lines piercing the surface" is a literal interpretation

Field lines are a visualisation tool whose density is set by convention: you agree that in regions where E is large, you will draw many lines per unit area, and where E is small, few. Specifically, the standard convention is to draw lines so that the number per unit area perpendicular to \vec{E} equals E (or a scaled version of it, as long as you are consistent).

With that convention, the number of lines that pierce a tilted surface of area A is number of lines through the projection perpendicular to \vec{E} = E times the projected area = E \cdot A\cos\theta = EA\cos\theta = \Phi.

So flux literally equals the number of field lines piercing the surface in this counting convention. The formula is not metaphorical; it is an exact equality once you set the line-drawing convention. This is why physicists talk about "the flux of field lines" and why the picture of Gauss's law will be "the total number of lines coming out of a closed surface equals the amount of charge enclosed (up to a universal constant)."

2. Non-uniform fields and curved surfaces

If the field is not uniform over the surface, or the surface is not flat, equation (1) no longer applies as written. The fix is exactly what you would guess — and exactly parallel to the continuous-distribution integrals you built in the superposition article.

The integral definition

Divide the surface S into many tiny patches, each small enough that over its extent (i) the field \vec{E} is effectively uniform, and (ii) the patch is effectively flat. Each patch has an infinitesimal area \mathrm{d}A and a local normal \hat{n}. Assign the patch an infinitesimal area vector

\mathrm{d}\vec{A} \;=\; \hat{n}\,\mathrm{d}A.

The flux through this patch is \mathrm{d}\Phi = \vec{E}\cdot\mathrm{d}\vec{A}, using the local field at the patch and the patch's local normal. Summing (integrating) over the whole surface:

\boxed{\;\Phi_E \;=\; \int_S \vec{E}\cdot\mathrm{d}\vec{A}.\;} \tag{2}

Why: the construction is identical to every other integral in physics — chop the thing into pieces small enough that the physics is simple on each piece, solve each piece with a local formula, and sum. Here the "local formula" is \mathrm{d}\Phi = \vec{E}\cdot\mathrm{d}\vec{A} and the sum becomes an integral over the surface.

The choice of \hat{n} must be consistent across the surface — every patch's normal must be on the same "side" as its neighbours. For a flat open surface, you simply pick a side and commit. For a curved open surface, you pick a side (e.g., the "upper" side of a dome), and \hat{n} varies from patch to patch but always points into the "upper" half-space. The choice of side flips the sign of \Phi; the magnitude is unchanged.

Example: flux of a uniform field through a hemisphere

A uniform field \vec{E} = E_0\hat{k} passes through a hemispherical shell of radius R placed with its circular edge on the xy-plane (so the dome opens upward along +\hat{k}). Find the flux through the curved (dome) surface, taking \hat{n} as the outward normal of the dome.

Setup. A point on the dome at polar angle \vartheta (measured from the +z-axis) and azimuth \phi has position R(\sin\vartheta\cos\phi,\ \sin\vartheta\sin\phi,\ \cos\vartheta) and outward normal \hat{n} = (\sin\vartheta\cos\phi,\ \sin\vartheta\sin\phi,\ \cos\vartheta). The area element is \mathrm{d}A = R^2\sin\vartheta\,\mathrm{d}\vartheta\,\mathrm{d}\phi, so \mathrm{d}\vec{A} = \hat{n}\,R^2\sin\vartheta\,\mathrm{d}\vartheta\,\mathrm{d}\phi.

Dot product. \vec{E}\cdot\hat{n} = E_0\cos\vartheta.

Integral. Over the hemisphere, \vartheta runs from 0 to \pi/2 (the dome covers only the upper half) and \phi from 0 to 2\pi:

\Phi = \int_0^{2\pi}\!\int_0^{\pi/2} E_0\cos\vartheta \cdot R^2\sin\vartheta\,\mathrm{d}\vartheta\,\mathrm{d}\phi = 2\pi R^2 E_0 \int_0^{\pi/2}\cos\vartheta\sin\vartheta\,\mathrm{d}\vartheta.

Using \cos\vartheta\sin\vartheta = \tfrac{1}{2}\sin 2\vartheta and \int_0^{\pi/2}\sin 2\vartheta\,\mathrm{d}\vartheta = 1 (check: antiderivative -\tfrac{1}{2}\cos 2\vartheta, evaluated at \pi/2 gives \tfrac{1}{2}, at 0 gives -\tfrac{1}{2}, difference 1), we get \int_0^{\pi/2}\cos\vartheta\sin\vartheta\,\mathrm{d}\vartheta = 1/2.

\Phi = 2\pi R^2 E_0 \cdot \tfrac{1}{2} = \pi R^2 E_0. \tag{3}

Why: the flux through the dome equals the flux through the flat circular base of the same radius — which is E_0\cdot(\pi R^2) = \pi R^2 E_0, by the "aligned field through flat surface" formula (1). This match is not coincidence. Any field line that enters the hemisphere through the flat bottom must exit through the curved top (a uniform field has no sources or sinks inside). The flux through the dome equals the flux through any other surface with the same edge in the same field.

That observation — that flux through a surface depends only on the surface's boundary, not on its shape, as long as the field has no sources inside — is one formulation of the idea that will become Gauss's law. You will see it again in a moment, cleaner, for closed surfaces.

Uniform field through a hemisphere equals uniform field through its flat baseA hemispherical dome sits on a flat circular base. A uniform vertical field passes through both. Arrows show field lines entering through the base and exiting through the dome; the same arrows count the same flux.Φ through dome = Φ through base = πR² E₀E
For a uniform field and a dome sharing its edge with a flat disc, the flux through the dome equals the flux through the disc. This is not magic — it reflects the fact that the field has no sources in the region, so every line that enters one side exits the other.

3. Closed surfaces and the outward-normal convention

A closed surface is one that completely encloses a finite volume — think of a balloon, a cube, a sphere. It has no edges. By convention, for a closed surface, \hat{n} is always taken to be the outward normal. With this convention, positive flux means field lines leave the enclosed volume, negative flux means they enter it.

The flux over a closed surface is written with a circle through the integral sign:

\Phi_E \;=\; \oint_S \vec{E}\cdot\mathrm{d}\vec{A}.

Why: the oint symbol is a visual reminder that the integration domain is closed. It plays no role in how you calculate — it is a typographic convention signalling which kind of surface you are dealing with.

The net flux through a closed surface in a uniform field is zero

Place a closed surface — any shape — inside a region where the field is uniform, \vec{E} = \vec{E}_0. The net flux is

\oint \vec{E}_0\cdot\mathrm{d}\vec{A} \;=\; \vec{E}_0\cdot\oint\mathrm{d}\vec{A}.

The vector integral \oint \mathrm{d}\vec{A} over any closed surface is identically zero, because the contributions from opposite sides of any slab cancel in pairs — the outward normal on one face is the inward normal on the opposite face, and the areas match. (A formal proof uses the divergence theorem: \oint\mathrm{d}\vec{A} = \int\nabla\cdot\hat{k}\,\mathrm{d}V = 0 for any constant vector \hat{k}, but the intuition is just pairs-cancelling.) So:

\oint\vec{E}_0\cdot\mathrm{d}\vec{A} \;=\; 0 \qquad (\text{uniform field, closed surface}).

Physically: every field line that enters the closed volume through one side must exit through another, so the net flux is zero. The "in" and "out" contributions cancel exactly.

Flux of a point charge through a spherical surface around it

Place a point charge Q at the origin. Surround it with a sphere of radius r, concentric with the charge. At every point on the sphere, the field is

\vec{E} \;=\; \frac{1}{4\pi\varepsilon_0}\,\frac{Q}{r^2}\,\hat{r},

where \hat{r} points radially outward from the charge. The outward normal to the sphere is also \hat{r}. So

\vec{E}\cdot\hat{n} \;=\; \frac{1}{4\pi\varepsilon_0}\,\frac{Q}{r^2}.

This is constant over the sphere, so the integral simplifies:

\Phi \;=\; \oint\vec{E}\cdot\mathrm{d}\vec{A} \;=\; \frac{Q}{4\pi\varepsilon_0 r^2}\cdot(\text{area of sphere}) \;=\; \frac{Q}{4\pi\varepsilon_0 r^2}\cdot 4\pi r^2 \;=\; \frac{Q}{\varepsilon_0}.
\boxed{\;\Phi_E^{\text{sphere around point charge}} \;=\; \frac{Q}{\varepsilon_0}.\;} \tag{4}

Why: two factors of r cancel — the 1/r^2 from the inverse-square field and the r^2 from the sphere's area. The flux ends up independent of the sphere's radius. That is a deeply physical statement: if you draw a bigger sphere around the same charge, the field is weaker (as 1/r^2), but the surface area is proportionally larger (as r^2), so the same number of field lines pierce each sphere. The number of lines depends only on the enclosed charge, not on where you draw your boundary.

Flux of a point charge through any closed surface enclosing it

Now take a point charge Q at the origin and surround it with any closed surface S — not necessarily a sphere, not necessarily concentric. As long as Q is inside S, the flux is still Q/\varepsilon_0.

The argument: imagine drawing a small sphere S_0 of radius \epsilon tightly around the charge, and the arbitrary surface S outside it. The region between S_0 and S contains no charge, so field lines neither begin nor end there. Every field line that enters the region through S_0 must leave through S (and vice versa). Since S_0 is a sphere around the point charge, the flux out of S_0 is Q/\varepsilon_0. The same field lines that leave S_0 must cross S, so the flux out of S is also Q/\varepsilon_0.

This is the heart of Gauss's law. The flux through a closed surface depends only on the charge enclosed, not on the surface's shape or size. The next article, Gauss's law, promotes this observation to a fundamental law and shows how it constrains the field.

Any closed surface enclosing a point charge has the same flux through itA point charge sits at the centre. Around it, a sphere and an irregular blob-shaped closed surface. Radial field lines from the charge cross both surfaces; the same lines count the same flux.+Qarbitrary surface Ssphere S₀Φ through S = Φ through S₀ = Q/ε₀
Any closed surface enclosing a point charge lets through exactly $Q/\varepsilon_0$ of flux. The field lines from the charge all pierce the surface once (on their way to infinity), and no other field lines enter — so the line count is fixed by the enclosed charge alone.

4. Worked examples

Example 1: Flux through a rectangle in a uniform field

A uniform electric field \vec{E} = (200\,\hat{i} + 300\,\hat{j}) N/C passes through a rectangular surface of area A = 0.50 m² that lies in the xy-plane (so its normal is along \hat{k}). What is the electric flux through the rectangle?

A uniform field passes parallel to a flat rectangle in the xy-planeA rectangle lies flat in the xy-plane. Field arrows point in the xy-plane, along E equals 200 i hat plus 300 j hat. Since the field is parallel to the rectangle, no field component lies along the z-normal, and the flux is zero.A = 0.5 m², in xy-planeEn̂ = k̂
A rectangle in the $xy$-plane, normal $\hat{n} = \hat{k}$, with a field that lies entirely in the $xy$-plane. The field is parallel to the surface; no field lines pierce it.

Step 1. Write the area vector.

The rectangle lies in the xy-plane, so its normal is along the z-axis: \hat{n} = \hat{k}. Choose it to be +\hat{k}. Then

\vec{A} \;=\; A\,\hat{n} \;=\; 0.50\,\hat{k}\,\text{m}^2.

Why: the area vector encodes both the size and orientation of the surface. By choosing \hat{n} = +\hat{k} (rather than -\hat{k}), you are implicitly saying "I will call flux going in the +z-direction positive."

Step 2. Compute \vec{E}\cdot\vec{A}.

\vec{E}\cdot\vec{A} \;=\; (200\,\hat{i} + 300\,\hat{j})\cdot(0.50\,\hat{k}) \;=\; 0.

Why: \hat{i}\cdot\hat{k} = 0 and \hat{j}\cdot\hat{k} = 0, because the unit vectors are mutually perpendicular. The field has no component in the \hat{k} direction.

Step 3. Interpret.

The field lies entirely in the xy-plane — parallel to the rectangle. No field lines pierce the rectangle; they all slide across its surface.

Result: \Phi = 0.

What this shows: You do not need to compute \theta and \cos\theta when both vectors are given in component form; just dot-product them. A field parallel to a flat surface contributes zero to the flux, independent of the field's strength. This also illustrates why the area vector lives along the normal, not the surface itself: the area vector stores the "direction perpendicular" that the dot product extracts.

Example 2: Flux through a cubic box due to a uniform field

A uniform electric field \vec{E} = E_0\hat{i} passes through a cubical box of side L, oriented with its faces parallel to the coordinate planes. Compute the flux through each face, and show that the total flux out of the cube is zero.

Cube in a uniform field; flux through each faceA 3D cube drawn in oblique perspective, with a uniform horizontal electric field E₀ i-hat passing through it. The right face (normal plus i) gets positive flux; the left face (normal minus i) gets equal negative flux; the top, bottom, front and back faces have zero flux because their normals are perpendicular to the field.E₀
A uniform field points in $+\hat{i}$. Field enters the left face and exits the right; the net flux out of the cube is zero.

Step 1. List the six faces and their outward normals.

Label the faces by the direction of their outward normal:

  • Right face: \hat{n} = +\hat{i}, area L^2.
  • Left face: \hat{n} = -\hat{i}, area L^2.
  • Top, Bottom: \hat{n} = \pm\hat{k}, area L^2.
  • Front, Back: \hat{n} = \pm\hat{j}, area L^2.

Step 2. Compute the flux through each face.

Right face: \Phi_R = \vec{E}\cdot\vec{A}_R = E_0\hat{i}\cdot L^2\hat{i} = +E_0 L^2.

Left face: \Phi_L = \vec{E}\cdot\vec{A}_L = E_0\hat{i}\cdot(L^2)(-\hat{i}) = -E_0 L^2.

Top, Bottom, Front, Back: \vec{E}\cdot\hat{n} = 0 (since \hat{i}\cdot\hat{j} = \hat{i}\cdot\hat{k} = 0), so flux through each is 0.

Why: the field has only an \hat{i} component, and only two of the six face-normals have an \hat{i} component. The other four faces are edge-on to the field.

Step 3. Add the six contributions.

\Phi_{\text{net}} \;=\; \Phi_R + \Phi_L + \Phi_T + \Phi_B + \Phi_F + \Phi_{\text{Back}} \;=\; +E_0 L^2 - E_0 L^2 + 0 + 0 + 0 + 0 \;=\; 0.

Result: The net flux out of the cube is zero. Equal positive flux flows out of the right face as flows in through the left face.

What this shows: In a uniform field — a field with no sources or sinks in the region — every field line that enters a closed volume must leave. The net flux is zero. This is exactly what Gauss's law will say: a region with no enclosed charge has zero net flux. Here there is no charge inside the cube, and the accounting confirms it.

Example 3: Flux through a closed hemisphere from a central field source

A point charge Q = 5\,\mu\text{C} sits at the origin. Find the flux through (a) a hemispherical shell of radius R = 0.30 m whose flat base is the xy-plane, and (b) the disc that closes off this hemisphere at the xy-plane.

Point charge at origin; flux through hemisphere and base discA point charge sits at the origin. A hemispherical dome opens upward above it; a flat disc closes the hemisphere at the xy-plane. Field lines radiate outward from the charge; half of them pierce the dome, the other half would pierce the bottom half of a full sphere.+Qhemisphere S₁flat disc S₂By symmetry half the flux from Q pierces the dome.
A point charge at the origin radiates field lines in every direction. Half go up through the hemispherical dome; half go down through the base plane. The flux is split equally by symmetry.

Step 1. Observe the symmetry.

The charge sits on the boundary between the upper hemisphere and the lower hemisphere. By rotational symmetry about the vertical axis — and by the up-down symmetry of a point-charge field — exactly half of the total outgoing flux goes upward (through the dome) and half goes downward.

Why: a point charge radiates isotropically. The plane z = 0 cuts the space into two equal halves. Every unit solid angle in the upper half has a matching unit solid angle in the lower half, so half the total flux is on each side.

Step 2. Use the point-charge-in-enclosing-surface result.

A full sphere of any radius around the charge has flux Q/\varepsilon_0, from equation (4). A hemisphere has half that:

\Phi_{\text{dome}} \;=\; \frac{1}{2}\cdot\frac{Q}{\varepsilon_0} \;=\; \frac{Q}{2\varepsilon_0}.

Why: the symmetry argument from step 1, applied to the result that the full sphere captures total flux Q/\varepsilon_0. You could alternatively do the explicit integral \int E\cdot\mathrm{d}A over the dome, but symmetry shortcuts it.

Step 3. Compute the flux through the flat disc.

The flat disc S_2 lies in the xy-plane. The field at every point on the disc (which sits at z = 0, away from the origin) points radially outward in the xy-plane — parallel to the disc surface. The component of \vec{E} along the disc normal \hat{k} is zero everywhere on the disc.

So

\Phi_{\text{disc}} \;=\; \int_{S_2}\vec{E}\cdot\mathrm{d}\vec{A} \;=\; 0.

Why: the point-charge field at any point in the xy-plane lies entirely in the xy-plane (it is a radial vector from the origin to the field point, and both origin and field point lie in the xy-plane). The disc's normal is \hat{k}; the field has no \hat{k}-component; the dot product is zero pointwise. A zero integrand gives a zero integral.

Step 4. Plug numbers.

\Phi_{\text{dome}} = \frac{Q}{2\varepsilon_0} = \frac{5\times 10^{-6}}{2\times 8.854\times 10^{-12}} \;\approx\; 2.82\times 10^{5}\,\text{N}\cdot\text{m}^2/\text{C}.

Result: \Phi_{\text{dome}} \approx 2.82\times 10^{5}\,\text{N}\cdot\text{m}^2/\text{C}; \Phi_{\text{disc}} = 0.

What this shows: Two pieces of machinery at once. First, symmetry can do an integral for you — the hemisphere flux is \tfrac{1}{2}Q/\varepsilon_0 without any explicit integration. Second, a surface whose normal is perpendicular to the field everywhere has zero flux, even if the field is strong. These two tricks — exploiting symmetry and spotting zero-integrand surfaces — are exactly the tricks that make Gauss's law practical.

5. Common confusions

If you came here to understand how flux is defined and computed, you have what you need. What follows is for readers who want the formal connection to vector calculus, the divergence theorem, and the bridge to Gauss's law.

Flux as a surface integral — the formal machinery

The expression \int_S \vec{E}\cdot\mathrm{d}\vec{A} is an instance of the general concept of a surface integral of a vector field. In coordinates, if the surface is described parametrically by \vec{r}(u, v) with u, v ranging over some region D in a parameter plane, the surface element is

\mathrm{d}\vec{A} \;=\; \left(\frac{\partial \vec{r}}{\partial u}\times\frac{\partial \vec{r}}{\partial v}\right)\mathrm{d}u\,\mathrm{d}v,

and the flux becomes

\Phi \;=\; \int_D \vec{E}\bigl(\vec{r}(u,v)\bigr)\cdot\left(\frac{\partial\vec{r}}{\partial u}\times\frac{\partial\vec{r}}{\partial v}\right)\mathrm{d}u\,\mathrm{d}v.

This general parametrisation lets you compute the flux through any smooth surface, however wiggly. For the simple surfaces in this article — flat rectangles, spheres, cylinders — the intuitive formulas \mathrm{d}A = \mathrm{d}x\,\mathrm{d}y, R^2\sin\vartheta\,\mathrm{d}\vartheta\,\mathrm{d}\phi, etc. are just special cases.

The divergence theorem

A cornerstone of vector calculus states that for any vector field \vec{F} and any closed surface S bounding a volume V,

\oint_S \vec{F}\cdot\mathrm{d}\vec{A} \;=\; \int_V (\nabla\cdot\vec{F})\,\mathrm{d}V.

This is the divergence theorem (also known as Gauss's theorem — a different Gauss theorem from the electric one, though named for the same mathematician). It says that the flux of a vector field out of a closed surface equals the volume integral of the field's divergence inside.

Apply it to the electric field. For electrostatics, Maxwell's equation \nabla\cdot\vec{E} = \rho/\varepsilon_0 is the local form of Gauss's law. Integrating over a volume V:

\int_V \nabla\cdot\vec{E}\,\mathrm{d}V \;=\; \int_V \frac{\rho}{\varepsilon_0}\mathrm{d}V \;=\; \frac{Q_{\text{enc}}}{\varepsilon_0}.

By the divergence theorem, the left-hand side is \oint_S\vec{E}\cdot\mathrm{d}\vec{A}. So

\oint_S \vec{E}\cdot\mathrm{d}\vec{A} \;=\; \frac{Q_{\text{enc}}}{\varepsilon_0}.

This is Gauss's law in integral form. The divergence theorem is the mathematical backbone that lets you move between local (Maxwell's equation in differential form) and global (Gauss's law in flux form) statements. You will see the global form in action in the next article.

Flux of the magnetic field — where the story is different

A small aside that foreshadows a later topic. For the magnetic field \vec{B}, the analogous Maxwell's equation is \nabla\cdot\vec{B} = 0. So the magnetic flux out of any closed surface is identically zero:

\oint_S\vec{B}\cdot\mathrm{d}\vec{A} \;=\; 0.

Physically, this says there are no magnetic monopoles — no isolated "north" or "south" poles that act as sources of \vec{B}. Every magnetic field line that enters a closed surface must leave; you cannot trap a magnetic field line by enclosing a region. The electric story, by contrast, does have sources (positive charges) and sinks (negative charges), which is why electric flux through a closed surface can be nonzero.

A subtlety: flux through an open surface vs. through its closure

Two different open surfaces that share the same boundary can have different flux through them, if the field has sources in the region between them. But if the region between the two surfaces contains no charge (no sources, no sinks), the flux through them is equal — because closing the two surfaces together forms a closed surface with zero enclosed charge, hence zero net flux, which forces the two open-surface fluxes to agree (with appropriate signs).

This is why, in the hemisphere example above, the flux through the dome equalled the flux through the disc in a uniform field: the uniform field has no sources in the region, so the "open hemisphere + open disc minus their common orientation" closed surface encloses zero charge, and the fluxes through the two open surfaces must be opposite in sign (i.e., equal in the outward-consistent sense).

Flux and solid angle — a cleaner picture

For a point charge at the centre of a surface (any surface), there is a particularly elegant way to see that the flux depends only on the solid angle subtended by the surface from the charge. Around the charge at a distance r, a patch of surface area \mathrm{d}A with outward normal \hat{n} subtends a solid angle

\mathrm{d}\Omega \;=\; \frac{\hat{r}\cdot\hat{n}\,\mathrm{d}A}{r^2}.

The flux contribution of this patch is

\mathrm{d}\Phi \;=\; \vec{E}\cdot\hat{n}\,\mathrm{d}A \;=\; \frac{Q}{4\pi\varepsilon_0}\,\frac{\hat{r}\cdot\hat{n}}{r^2}\,\mathrm{d}A \;=\; \frac{Q}{4\pi\varepsilon_0}\,\mathrm{d}\Omega.

Integrating over a closed surface, the total solid angle is 4\pi, so

\Phi \;=\; \frac{Q}{4\pi\varepsilon_0}\cdot 4\pi \;=\; \frac{Q}{\varepsilon_0}.

This gives the result (equation 4) without any reference to the surface's shape — the two factors of r^2 (one from the field, one from the area element, in opposite directions) never survive the solid-angle parameterisation. It is the cleanest derivation that this result does not depend on which closed surface you choose around the charge, as long as it encloses the charge exactly once.

The "encloses exactly once" qualifier matters. A surface that wraps around the charge twice — think of a balloon with a handle that loops back through itself — would capture flux 2Q/\varepsilon_0. For the ordinary, simply-connected surfaces you draw in practice, every point outside the surface is reached by field lines that pass through the surface exactly once, and the result Q/\varepsilon_0 holds.

Where this leads next