Molecular glue for DNA is a small synthetic ligand that adheres two single-stranded DNAs to produce a double-stranded DNA. We previously devised a photoswitchable molecular glue (PMG) that uses external light stimuli to reversibly control DNA hybridization. To optimize the structure of PMG, we synthesized a series of PMGs and evaluated the effect of changing the methylene linker length on the binding affinity and photoresponse. From the comprehensive T m and CSI-TOF-MS measurements, a PMG possessing a three-methylene linker with carbamate linkage produced maximum binding affinity and photoswitching ability. These results indicate that a small difference in the linker can significantly affect PMG function. These findings are useful for designing new photoswitchable DNA-binding ligands.