The white wire is the common or neutral wire in a 100-volt service, but the wire can also be gray in color. A white or gray wire can only be connected to another white or gray wire. Knowing the color code is essential for setting up the correct configuration of an electrical system and for safety.
As a neutral wire, the white wire connects to the neutral bus bar in an electrical panel. The bus bar attracts the electric current to be distributed to feeders. Although neutral, the white wire can still carry electrical currents. Specifically, it carries the overload of electricity that's not being used and is returned to the electrical service.
Grounding is a method of returning electricity safely and effectively to the service panel. The neutral wire is the return path. In some systems, there is an additional grounding path to carry electricity safely to the ground without endangering anyone in the event of a short circuit.
The black wire is used for power in all circuits. The black wire is not the common wire, and it is never used as a ground or neutral wire. It should always be considered hot or live and is the power feed to an electrical outlet. It is also often used as a switch leg, which is the connection from the switch to the electrical load.