Mixed halide perovskites that are thermodynamically stable in the dark demix under illumination. This is problematic for their application in solar cells. We present a unified thermodynamic theory for this light-induced halide segregation that is based on a free energy lowering of photocarriers funnelling to a nucleated phase with different halide composition and lower band gap than the parent phase. We apply the theory to a sequence of mixed iodine-bromine perovskites. The spinodals separating metastable and unstable regions in the composition-temperature phase diagrams only slightly change under illumination, while light-induced binodals separating stable and metastable regions appear signalling the nucleation of a low-band gap iodine-rich phase. We find that the threshold photocarrier density for halide segregation is governed by the band gap difference of the parent and iodine-rich phase. Partial replacement of organic cations by cesium reduces this difference and therefore has a stabilizing effect.