We propose and experimentally demonstrate simultaneous format and wavelength conversion at 40 Gb/s exploiting a single commercial semiconductor optical amplifier Mach-Zehnder interferometer. Conversion from nonreturn-to-zero (NRZ) to a 2-ps return-to-zero (RZ) on-off keying (OOK) format suitable for grooming onto a 160-Gb/s optical time-division-multiplexing frame is achieved. Furthermore, for the first time to the best of our knowledge, 40-Gb/s conversion from RZ OOK to RZ binary phase-shift keying (BPSK) is achieved. The effectiveness of the proposed scheme is demonstrated by means of bit-error-rate measurements. Error-free operations are reported, with a power penalty of 0.5 dB for the case of NRZ-to-RZ OOK conversion and of 3 dB (comprehensive of the degradation due to the wavelength conversion used to generate the probe signal) for the case of OOK-to-BPSK conversion.