In practice, charge conservation is a physical law that states that the net change in the amount of electric charge in a specific volume of space is exactly equal to the net amount of charge flowing into the volume minus the amount of charge flowing out of the volume. In essence, charge conservation is an accounting relationship between the amount of charge in a region and the flow of charge into and out of that same region.
Mathematically, we can state the law as
Q(t) is the quantity of electric charge in a specific volume at time t, QIN is the amount of charge flowing into the volume between time t1 and t2, and QOUT is the amount of charge flowing out of the volume during the same time period.
The charge conservation can also be understood as a conclusion of the Noether's theorem, a central result in theoretical physics that expresses the one-to-one correspondence between symmetries and conservation laws. The invariance with respect to the gauge invariance of the electric potential and vector potential gives conservation of electric charge.
More formally, we can use the concepts of vector and differential calculus to express the law in terms of charge density ρ (in coulombs per cubic meter) and electric current density J (in amperes per square meter):
This statement is equivalent to a conservation of four-current. In the mid-nineteenth century, James Clerk Maxwell postulated the existence of electromagnetic waves as a result of his discovery that Ampère's law (in its original form) was inconsistent with the conservation of charge. After correctly reformulating Ampère's law, Maxwell also realized that such waves would travel at the speed of light, and that light itself must be a form of electromagnetic radiation. See electromagnetic wave equation for a full discussion of these discoveries.
From the Divergence theorem this can be written
The net current into a volume must necessarily equal the net change in charge within the volume.