A mechanism of water (ice) electrification during evaporation or condensation is proposed, based on non-linear equations of electrodiffusion in a moving medium. The electrification is caused by the difference in coefficients of the diffusion of intrinsic charge carriers in water (ice), i.e., protons and hydroxide ions, as well as their accumulation and depletion at the evaporation and condensation front accordingly. The accumulation (depletion) of the carriers is contingent on the existence of a potential barrier for the transition from water (ice) to vapor. The electrification intensity is affected by a double electric layer created by orientational defects at the surface of water (ice). Dependencies are calculated between the electric field intensity at a flat surface of water and ice, and the phase transformation rate. The electric charge of spherical water droplets is evaluated for various droplet radii.