We investigate the role of the electromagnetic interaction in the formation and decay of the X(3872). The binding properties of the X(3872) are studied by assuming the molecular nature and considering the S−D wave mixing, isospin breaking, and coupled channel effects, and in particular the correction from the electromagnetic interaction. The radiative decays can better reflect the difference between the charged and neutral DD¯* components, since the electromagnetic interaction explicitly breaks the isospin symmetry. We further study the radiative decay widths with the obtained wave functions for different DD¯* channels. We also explore other similar hidden-charm molecular states. The electromagnetic interaction can make the molecule tighter. Our result of the radiative decay width for X(3872)→γJ/ψ is in agreement with the experiment. The branching ratio Rγψ is less than 1 in our framework, which supports the Belle and BESIII measurements. Published by the American Physical Society 2024