Understanding the Gauss's law calculator — concept and principle
This calculator applies Gauss's law to find the electric field of symmetric charge distributions: a point charge, a uniformly charged solid sphere, a thin shell or conductor, an infinite line and an infinite sheet. It also reports the enclosed charge, the flux and the Gaussian surface used. It is a standard aid for electromagnetism homework.
How it is calculated
Gauss's law: Φ = Q_enc ÷ ε₀
- Point charge, or outside any spherical distribution: E = Q ÷ (4π ε₀ r²)
- Inside a uniformly charged solid sphere: E = Q r ÷ (4π ε₀ R³)
- Inside a thin shell or conductor: E = 0
- Infinite line: E = λ ÷ (2π ε₀ r); infinite sheet: E = σ ÷ (2ε₀)
- Q is in nC, λ in nC/m, σ in nC/m²; ε₀ = 8.8541878188 × 10⁻¹² F/m. At r = R the outside formula is used.
The principle
Gauss's law says the total electric flux out of any closed surface depends only on the charge inside it. For a symmetric charge you can choose a surface on which the field has the same size everywhere and points straight out. Then the flux is simply E times the area, and solving for E is easy. A sphere around a ball of charge has area 4πr², which gives the inverse-square law; a cylinder around a line gives 1/r; a box through a sheet gives a field independent of distance.
Worked example
Default inputs: solid sphere, Q = 10 nC, R = 0.1 m, r = 0.2 m.
- r > R, so the point is outside and all the charge is enclosed: 10 nC.
- E = 10 × 10⁻⁹ ÷ (4π × 8.854 × 10⁻¹² × 0.2²) = 2,247 N/C.
- The charge is positive, so the field points outward, away from the charge.
- Flux = 10⁻⁸ ÷ 8.854 × 10⁻¹² = 1,129 N·m²/C through a sphere of radius r.
| Distance from the centre, axis or sheet r (m) | Electric field magnitude E (N/C) |
|---|---|
| 0.05 | 4,494 |
| 0.1 | 8,988 |
| 0.15 | 3,994 |
| 0.2 | 2,247 |
| 0.25 | 1,438 |
| 0.3 | 998.6 |
| 0.4 | 561.7 |
How to read the result
Outside a sphere the field is the same as if all the charge sat at the centre. Inside a solid sphere it grows linearly from zero at the centre; inside a shell it is zero. N/C is the same as V/m. The flux is independent of r, which is a quick check that you have the right enclosed charge.
Common mistakes
- Using the outside formula for a point inside a solid sphere.
- Using Gauss's law to find E for shapes without enough symmetry. The law still holds, but E is not constant on the surface.
- Forgetting the nano prefix.
- Treating a finite sheet or rod as infinite far from it.
Frequently asked questions
Why is the field inside a conducting shell zero?
No charge is enclosed by a Gaussian surface inside it, and by symmetry the field must then vanish.
Why does a sheet's field not depend on distance?
Field lines from an infinite sheet stay parallel, so they do not spread out.
Is N/C the same as V/m?
Yes, the two units are identical.
Sources: G. Rybka, Physics 122 lecture notes, University of Washington (Gauss's law) · CODATA 2022 recommended values (ε₀), NIST