The atomic microstructure of alloys is rarely perfectly random, instead exhibiting differently shaped precipitates, clusters, zigzag chains, etc. While it is expected that such microstructural features will affect the electronic structures ͑carrier localization and band gaps͒, theoretical studies have, until now, been restricted to investigate either perfectly random or artificial "guessed" microstructural features. In this paper, we simulate the alloy microstructures in thermodynamic equilibrium using the static Monte Carlo method and study their electronic structures explicitly using a pseudopotential supercell approach. In this way, we can bridge atomic microstructures with their electronic properties. We derive the atomic microstructures of InGaN using ͑i͒ density-functional theory total energies of ϳ50 ordered structures to construct a ͑ii͒ multibody cluster expansion, including strain effects to which we have applied ͑iii͒ static Monte Carlo simulations of systems consisting of over 27000 atoms to determine the equilibrium atomic microstructures. We study two types of alloy thermodynamic behavior: ͑a͒ under lattice incoherent conditions, the formation enthalpies are positive and thus the alloy system phase-separates below the miscibility-gap temperature T MG , ͑b͒ under lattice coherent conditions, the formation enthalpies can be negative and thus the alloy system exhibits ordering tendency. The microstructure is analyzed in terms of structural motifs ͑e.g., zigzag chains and In n Ga 4−n N tetrahedral clusters͒. The corresponding electronic structure, calculated with the empirical pseudopotentials method, is analyzed in terms of band-edge energies and wave-function localization. We find that the disordered alloys have no electronic localization but significant hole localization, while below the miscibility gap under the incoherent conditions, In-rich precipitates lead to strong electron and hole localization and a reduction in the band gap.