Gauss's Law & Electric Flux: Calculations for Spheres, Cubes & Disks

A point charge, a charged plane, and a charged sphere look like three different, painful integrals. Gauss's Law turns all three into arithmetic, once you pick the right imaginary surface to wrap around the charge.

By Petrus Sheya

August 12, 2026 · 8 min read

Here's a question that should bother you. The electric field from a point charge falls off as 1/r21/r^2. The field from an infinite charged sheet doesn't fall off at all, it's the same strength no matter how far you stand. Two totally different formulas, from two totally different setups.

So why do physics textbooks solve both of them with the exact same trick?

The trick is called Gauss's Law, and once it clicks, it doesn't just solve those two problems. It solves the sphere, the cube, and the disk with almost no calculus at all. Let's build it from the ground up.


A field line can't just stop in the middle of nowhere

Picture the electric field around a charge as a bundle of lines shooting outward, like spokes from a hub. Each line represents the direction (and roughly the strength) of the field at that point in space.

Now hold up a flat panel somewhere in that field. Some of those lines pass straight through it. Others might graze past it entirely, depending on how you angle the panel. The amount of field "passing through" a surface is called flux.

If the panel faces the field head-on, every line that would have hit that patch of space goes straight through it. Tilt the panel sideways and fewer lines cross it, even though the field itself hasn't changed at all. Tilt it a full 90 degrees, so it's edge-on to the field, and nothing gets through. The lines slide right past.

Drag the panel (or the slider) to tilt it. Only the field lines that actually pierce it count toward the flux.

A·cos(θ)uniform field E, pointing right
cos(θ)0.94
Φ = EA cos(θ)0.94 EA
Lines piercing panel5 / 7

Drag the panel above and watch the count of piercing lines change. Notice that what matters isn't the panel's tilt by itself, it's how much of the panel is actually facing the oncoming field. That "facing" amount is captured by a single number, cosθ\cos\theta, where θ\theta is the angle between the panel's face and the field direction.

So we write flux as:

Φ=EAcosθ\Phi = E \, A \cos\theta

EE is the field strength, AA is the panel's area, and cosθ\cos\theta handles the tilt. This is just a dot product between the field vector and the panel's area vector, the same dot product from vectors in 2D and 3D doing exactly what it always does: measuring how much one direction lines up with another.


The shape of the net doesn't matter, only what's inside it

Now here's the actual law. Instead of one flat panel, wrap a closed surface completely around a charge, like a balloon with the charge trapped inside. Add up the flux through every patch of that balloon's surface, all the way around.

Every field line that starts at the charge has to leave through the balloon somewhere. It has nowhere else to go. It can't stop in mid-air, and it can't loop back around, because field lines only start and end on charges. So the total flux out of the balloon is just... the total number of lines the charge produces.

And that number depends on exactly one thing: how much charge is trapped inside. Not the balloon's size. Not its shape. Not how lumpy or lopsided it is. Squish the balloon into a weird potato shape and the same lines still have to punch through it exactly once each, somewhere.

That's Gauss's Law:

Φtotal=EdA=Qencε0\Phi_{\text{total}} = \oint \vec{E} \cdot d\vec{A} = \frac{Q_{\text{enc}}}{\varepsilon_0}

The \oint just means "add up the flux over every patch of the closed surface." QencQ_{\text{enc}} is the charge enclosed, and ε0\varepsilon_0 is a constant that sets the units. Read the whole equation as one sentence: the total flux leaving a closed surface equals the enclosed charge, divided by a constant.

This is where it gets useful. Gauss's Law is true for any closed surface you can imagine. So when you're trying to find EE, you get to pick the surface. Pick a smart one, and the ugly integral on the left turns into plain multiplication.


Why physicists always reach for a sphere

Take the simplest possible source: a single point charge, sitting alone in space. What's the smartest surface to wrap around it?

A sphere, centered exactly on the charge. Here's why that choice is so good: by symmetry, the field has to point straight outward everywhere on that sphere, and it has to have the exact same strength at every point on it, since every point on the sphere is the same distance from the charge. That means EE is a constant on the whole surface, so it comes right out of the integral. EdA\oint \vec{E} \cdot d\vec{A} collapses into just EE times the sphere's total area.

Drag the dashed sphere in or out. The area it wraps changes, the field on it changes, but the two always cancel out.

+qr = 2.20
E(r) = kq/r²0.207
Area = 4πr²60.82
Φ = E·A12.57 (fixed)

Drag the sphere's radius above. Move it out, and the enclosed area grows, so the field spreads thinner. Move it in, and the area shrinks, so the field concentrates. The two effects trade off exactly, and the total flux never budges.

Let's write that trade-off out. The area of a sphere is 4πr24\pi r^2, so Gauss's Law says:

E4πr2=qε0E=q4πε0r2E \cdot 4\pi r^2 = \frac{q}{\varepsilon_0} \quad \Longrightarrow \quad E = \frac{q}{4\pi \varepsilon_0 r^2}

That's Coulomb's Law, derived, not assumed. And it also tells you exactly what Coulomb's constant kk actually is: k=1/(4πε0)k = 1/(4\pi\varepsilon_0). It was never a separate, mysterious number. It's just the leftover geometry from spreading a fixed amount of flux over a sphere's surface.


Same charge, weirder box: the cube proves the point

If Gauss's Law is really shape-independent, it should work for a lousy choice of surface too, not just the convenient sphere. Let's test that directly with a cube.

Slide the charge off-center inside the box (a cube, sliced through the middle). Each face grabs a different share of the flux, but the total never changes.

+qright 25%left 25%top 25%bottom 25%
right flux0.25 Φ₀
left flux0.25 Φ₀
top flux0.25 Φ₀
bottom flux0.25 Φ₀
Total flux1.00 Φ₀

Slide the charge off-center inside the box above. Watch what happens: the flux through each individual face shifts around constantly. The near faces grab a bigger share, the far faces get less. But add up all four (six, in the real 3D cube), and the total is frozen at exactly the same number the whole time.

That's the proof, made concrete. Gauss's Law doesn't care that a cube has flat faces, sharp corners, and wildly uneven field strength across its surface. It only cares about the charge trapped inside.

But notice something else: unlike the sphere, you can't actually solve for EE on a cube's face using this picture. The field isn't constant across a flat face the way it was constant across the sphere, so EE can't be pulled out of the integral. That's the real reason physicists reach for spheres and cylinders and flat pillboxes instead of cubes. Gauss's Law is true for every surface. It's only solvable on the symmetric ones.


The flat sheet trick: a field that never fades

Now for the strangest case: an infinite, flat sheet of charge. No point to center a sphere on, and no natural radius either. So what surface do you pick?

A pillbox. Picture a short cylinder (or a rectangular box) punched straight through the sheet, sticking out an equal distance on both sides. The sheet slices it exactly in half.

The marker walks away from the charged sheet. Watch the field readout: it never drops, no matter how far it travels.

E = 0.60infinite charged sheet (edge-on view)
Distance from sheet24 px
E = σ / 2ε₀0.60 (constant)

Two things make this surface solvable. First, by symmetry, the field has to point straight away from the sheet on both sides, with the same strength at any given distance. Second, along the pillbox's curved side walls, the field runs parallel to the wall, never through it, so those walls contribute zero flux. All the flux escapes through the two flat end caps.

Watch the marker above walk away from the sheet. The field readout doesn't budge. That's the part that feels wrong at first: shouldn't the field get weaker farther away, the way it does for a point charge? For an infinite sheet, no. Because the sheet is infinite, the field lines run in dead-straight, perfectly parallel columns. They never get the chance to spread out and thin themselves, the way lines fan out radially from a point charge. Same density of lines, forever.

Working through the pillbox with area AA per end cap and surface charge density σ\sigma (charge per unit area):

EA+EA=σAε0E=σ2ε0E \cdot A + E \cdot A = \frac{\sigma A}{\varepsilon_0} \quad \Longrightarrow \quad E = \frac{\sigma}{2\varepsilon_0}

No rr anywhere in that formula. Distance genuinely doesn't matter, and now you can see exactly why.

This same "pick the boring symmetric surface" move shows up again in magnetism. Ampere's Law is Gauss's Law's cousin: instead of flux through a closed surface, it deals with circulation around a closed loop, but the underlying idea is identical. Pick the loop that matches the symmetry of the current, and the hard integral turns into algebra again.


The short version

Flux measures how much of a field passes through a surface, and it only counts the part of the field pointing straight through, not sideways. Gauss's Law says the total flux out of any closed surface depends only on the charge trapped inside it, never on the surface's shape. That single fact means you're free to pick whatever surface makes the math easiest: a sphere around a point charge, a pillbox through a sheet, a cylinder around a wire. The field falls out of the calculation almost for free, as long as you pick a surface that matches the symmetry of the charge you're studying. Pick a bad surface, like a cube around an off-center charge, and the law is still true. It's just no longer useful for finding EE directly.


All visualizations are interactive React components running entirely in your browser, computed live from the actual field equations, not pre-baked animations. No libraries beyond React.