Abstract-We investigate nonlinear carrier dynamics in a multiquantum-well semiconductor optical amplifier (SOA) in the context of ultrafast all-optical logic. A rate-equation model is presented that accounts for two-photon absorption, free-carrier absorption, self-and cross phase modulation, carrier heating, spectral, spatial hole burning, and self-and cross polarization modulation. The nonlinear refractive index dynamics is investigated theoretically and experimentally. We find nonlinear phase changes larger than radians, which recovers on a timescale in the order of 1 ps. We also investigate a nonlinear AND gate that consists of an SOA that is placed in an asymmetric Mach-Zehnder interferometer. We show that the gate can be operated using 800-fJ optical pulses with duration of 200 fs while having a contrast ratio larger than 11 dB.Index Terms-Optical logic, optical signal processing ultrafast carrier dynamics, semiconductor optical amplifier.