MXenes have important research value in the field of photonics. In this work, Ti3C2 MXene was obtained by etching the Ti3AlC2 MAX phase with hydrofluoric acid, Ti3AlC2 and Ti3C2 nanosheets with a thickness of several nanometers were prepared by ultrasound-assisted liquid-phase exfoliation using anhydrous ethanol as the exfoliation solvent. The nonlinear absorption properties of the two nanosheets at 1064, 532 and 355 nm excitation wavelengths (infrared to ultraviolet band), especially the optical limiting behavior, were systematically investigated with the help of open aperture Z-scan technique. Interestingly, Ti3C2 MXene, obtained from Ti3AlC2 MAX by a simple hydrofluoric acid etching operation only, exhibits different nonlinear optical properties from Ti3AlC2 MAX under the same experimental conditions. Ti3AlC2 nanosheets exhibited excellent two-photon absorption behavior in the visible light band, while the two-photon absorption behavior of Ti3C2 nanosheets is better in the ultraviolet band. The excellent nonlinear absorption properties exhibited by Ti3AlC2 and Ti3C2 nanosheets demonstrate their advantages as OL materials with great potential for applications in laser protection.