A switchable dual-band binary and single-band quaternary phase-coded microwave signal generator based on a single dual-polarization dual-drive Mach–Zehnder modulator (DP-DDMZM) is proposed. Two radio frequency (RF) signals are first coupled with two bipolar coded signals and then used to drive the DP-DDMZM. When the frequencies of the two RF signals are different, the generator will be in dual-band binary phase-coded mode and a dual-band binary phase-coded signal can be generated. When the frequencies of the two RF signals are the same but their phase difference is adjusted to be 90°, the generator will be in single-band quaternary phase-coded mode and a single-band quaternary phase-coded signal can be obtained. Detailed analysis is carried out to illustrate the mechanism and a proof-of-concept experiment is also performed to demonstrate the feasibility. The dual-band binary and single-band quaternary phase-coded microwave signal are both experimentally generated and their performance is evaluated. The proposed generator features the advantages of simple structure, high flexibility and stable performance, which is promising in the future multifunctional radar systems.