The metal–organic framework NH2-MIL-53(Al) is the first solid-state material displaying nonlinear optical switching due to a conformational change upon breathing. A switching contrast of at least 38 was observed. This transition originates in the restrained linker mobility in the very narrow pore configuration.